chiark / gitweb /
exit-on-idle: only exit if actually idle
authorTom Gundersen <teg@jklm.no>
Fri, 13 Feb 2015 15:20:45 +0000 (16:20 +0100)
committerTom Gundersen <teg@jklm.no>
Fri, 13 Feb 2015 15:32:02 +0000 (16:32 +0100)
sd_event_wait() returning 0 usually means that it timed out, which means it must
have been idle. However, sd_event_wait() may return 0 in case an event was triggered
but it turned out there was nothing to do. Make the check for idle explicit to avoid
this edge-case.

src/libsystemd/sd-bus/bus-util.c

index c9d8713b25cade2e8ec3f01f8213805526daaefe..52d4ebe6112f919ce4572a0ae08bc4f47756f50a 100644 (file)
@@ -123,7 +123,7 @@ int bus_event_loop_with_idle(
                 if (r < 0)
                         return r;
 
                 if (r < 0)
                         return r;
 
-                if (r == 0 && !exiting) {
+                if (r == 0 && !exiting && idle) {
 
                         r = sd_bus_try_close(bus);
                         if (r == -EBUSY)
 
                         r = sd_bus_try_close(bus);
                         if (r == -EBUSY)