summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-event
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-03-14 12:09:20 +0100
committerTom Gundersen <teg@jklm.no>2015-03-14 12:17:24 +0100
commit02d30981b1bef116caee26ef3229fb910a88a394 (patch)
treef1859d3adc45e4228f9b6c310ab1e15be5e5416f /src/libsystemd/sd-event
parent2b0c9ef7352dae53ee746c32033999c1346633b3 (diff)
sd-event: sd_event_run - only return 0 on timeout
sd_event_dispatch() returns 0 on FINISH, so let's eat that up.
Diffstat (limited to 'src/libsystemd/sd-event')
-rw-r--r--src/libsystemd/sd-event/sd-event.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
index 2529a86233..376477f275 100644
--- a/src/libsystemd/sd-event/sd-event.c
+++ b/src/libsystemd/sd-event/sd-event.c
@@ -2490,15 +2490,23 @@ _public_ int sd_event_run(sd_event *e, uint64_t timeout) {
assert_return(e->state == SD_EVENT_INITIAL, -EBUSY);
r = sd_event_prepare(e);
- if (r > 0)
- return sd_event_dispatch(e);
- else if (r < 0)
+ if (r > 0) {
+ r = sd_event_dispatch(e);
+ if (r < 0)
+ return r;
+ else
+ return 1;
+ } else if (r < 0)
return r;
r = sd_event_wait(e, timeout);
- if (r > 0)
- return sd_event_dispatch(e);
- else
+ if (r > 0) {
+ r = sd_event_dispatch(e);
+ if (r < 0)
+ return r;
+ else
+ return 1;
+ } else
return r;
}