chiark / gitweb /
Remove some unused variables
[elogind.git] / src / network / networkd.c
index 769783000b1f4fb877606901e458f097f2a7fa80..360afba986056e3ceab0eb765ff230c231197488 100644 (file)
 ***/
 
 #include "sd-event.h"
+#include "sd-daemon.h"
 
 #include "networkd.h"
 
 int main(int argc, char *argv[]) {
-        _cleanup_manager_free_ Manager *m;
+        _cleanup_manager_free_ Manager *m = NULL;
         int r;
 
         log_set_target(LOG_TARGET_AUTO);
@@ -35,28 +36,41 @@ int main(int argc, char *argv[]) {
 
         if (argc != 1) {
                 log_error("This program takes no arguments.");
-                return EXIT_FAILURE;
+                r = -EINVAL;
+                goto out;
         }
 
         r = manager_new(&m);
+        if (r < 0)
+                goto out;
+
+        r = manager_load_config(m);
         if (r < 0)
                 return EXIT_FAILURE;
 
         r = manager_udev_listen(m);
         if (r < 0)
-                return EXIT_FAILURE;
+                goto out;
 
         r = manager_udev_enumerate_links(m);
         if (r < 0)
-                return EXIT_FAILURE;
+                goto out;
 
         r = manager_rtnl_listen(m);
         if (r < 0)
-                return EXIT_FAILURE;
+                goto out;
+
+        sd_notify(false,
+                  "READY=1\n"
+                  "STATUS=Processing requests...");
 
         r = sd_event_loop(m->event);
         if (r < 0)
-                return EXIT_FAILURE;
+                goto out;
+
+out:
+        sd_notify(false,
+                  "STATUS=Shutting down...");
 
-        return  EXIT_SUCCESS;
+        return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
 }