chiark / gitweb /
sd-event: sd_event_run - only return 0 on timeout
authorTom Gundersen <teg@jklm.no>
Sat, 14 Mar 2015 11:09:20 +0000 (12:09 +0100)
committerTom Gundersen <teg@jklm.no>
Sat, 14 Mar 2015 11:17:24 +0000 (12:17 +0100)
sd_event_dispatch() returns 0 on FINISH, so let's eat that up.

src/libsystemd/sd-event/sd-event.c

index 2529a86..376477f 100644 (file)
@@ -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;
 }