chiark / gitweb /
resolved: fix typo in sd_notify() call
[elogind.git] / src / resolve / resolved.c
index b4d743fe0dacabdcf224b210404507270e73a3b5..6dd4cade05e9346043afb9d087457bde30f2079b 100644 (file)
 #include "sd-event.h"
 #include "sd-daemon.h"
 #include "mkdir.h"
+#include "label.h"
 #include "capability.h"
 
-#include "resolved.h"
+#include "resolved-manager.h"
 #include "resolved-conf.h"
 
 int main(int argc, char *argv[]) {
@@ -38,14 +39,20 @@ int main(int argc, char *argv[]) {
         log_parse_environment();
         log_open();
 
-        umask(0022);
-
         if (argc != 1) {
                 log_error("This program takes no arguments.");
                 r = -EINVAL;
                 goto finish;
         }
 
+        umask(0022);
+
+        r = mac_selinux_init(NULL);
+        if (r < 0) {
+                log_error("SELinux setup failed: %s", strerror(-r));
+                goto finish;
+        }
+
         r = get_user_creds(&user, &uid, &gid, NULL, NULL);
         if (r < 0) {
                 log_error("Cannot resolve user name %s: %s", user, strerror(-r));
@@ -75,6 +82,12 @@ int main(int argc, char *argv[]) {
         if (r < 0)
                 log_warning("Failed to parse configuration file: %s", strerror(-r));
 
+        r = manager_start(m);
+        if (r < 0) {
+                log_error("Failed to start manager: %s", strerror(-r));
+                goto finish;
+        }
+
         /* Write finish default resolv.conf to avoid a dangling
          * symlink */
         r = manager_write_resolv_conf(m);
@@ -91,8 +104,12 @@ int main(int argc, char *argv[]) {
                 goto finish;
         }
 
+        sd_event_get_exit_code(m->event, &r);
+
 finish:
-        sd_notify(false, "STATUS=Shutting down...");
+        sd_notify(false,
+                  "STOPPING=1\n"
+                  "STATUS=Shutting down...");
 
         return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
 }