summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-event/sd-event.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsystemd/sd-event/sd-event.c')
-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;
}