dcavalca / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone
Blob Blame History Raw
From 6d148a842ebb04a9a9bc2853e167a9d8eddf8cd8 Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Tue, 26 Aug 2014 00:22:06 +0200
Subject: [PATCH] sd-event: sd_event_prepare - stay in PREPARED if
 sd_event_wait() indicates that no sources are pending

---
 src/libsystemd/sd-event/sd-event.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
index a71962c24c..32777e386b 100644
--- a/src/libsystemd/sd-event/sd-event.c
+++ b/src/libsystemd/sd-event/sd-event.c
@@ -2256,7 +2256,11 @@ _public_ int sd_event_prepare(sd_event *e) {
 
 pending:
         e->state = SD_EVENT_PREPARED;
-        return sd_event_wait(e, 0);
+        r = sd_event_wait(e, 0);
+        if (r == 0)
+                e->state = SD_EVENT_PREPARED;
+
+        return r;
 }
 
 _public_ int sd_event_wait(sd_event *e, uint64_t timeout) {