chiark / gitweb /
service: properly handle if the main process is down and we wait for the cgroup to...
[elogind.git] / src / cgroups-agent.c
index 92b56c5fbd7f080c37f33a6abf033002ca870f95..30aeede943d553491422fadaed7752d755209b95 100644 (file)
@@ -21,6 +21,8 @@
 
 #include <dbus/dbus.h>
 
+#include <stdlib.h>
+
 #include "log.h"
 #include "dbus-common.h"
 
@@ -28,7 +30,7 @@ int main(int argc, char *argv[]) {
         DBusError error;
         DBusConnection *bus = NULL;
         DBusMessage *m = NULL;
-        int r = 1;
+        int r = EXIT_FAILURE;
 
         dbus_error_init(&error);
 
@@ -49,7 +51,7 @@ int main(int argc, char *argv[]) {
                 dbus_error_free(&error);
 
                 if (!(bus = dbus_connection_open_private("unix:abstract=/org/freedesktop/systemd1/private", &error))) {
-                        log_error("Failed to get D-Bus connection: %s", error.message);
+                        log_error("Failed to get D-Bus connection: %s", bus_error_message(&error));
                         goto finish;
                 }
 
@@ -76,10 +78,11 @@ int main(int argc, char *argv[]) {
                 goto finish;
         }
 
-        r = 0;
+        r = EXIT_SUCCESS;
 
 finish:
         if (bus) {
+                dbus_connection_flush(bus);
                 dbus_connection_close(bus);
                 dbus_connection_unref(bus);
         }