[systemd-devel] [PATCH] journal-remote: check return code of sd_event_default

Andreas Henriksson andreas at fatal.se
Thu Sep 18 08:52:54 PDT 2014


Handle sd_event_default returning error and bail out properly
as done in every other caller of this function.

Found by coverity. Fixes: CID#1238957
---
 src/journal-remote/journal-remote.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c
index 12de820..f06c2cb 100644
--- a/src/journal-remote/journal-remote.c
+++ b/src/journal-remote/journal-remote.c
@@ -808,7 +808,11 @@ static int remoteserver_init(RemoteServer *s,
                 return -EINVAL;
         }
 
-        sd_event_default(&s->events);
+        r = sd_event_default(&s->events);
+        if (r < 0) {
+                log_error("Failed to allocate event loop: %s", strerror(-r));
+                return r;
+        }
 
         setup_signals(s);
 
-- 
2.1.0



More information about the systemd-devel mailing list