chiark / gitweb /
resolved: be a bit more communicative about conflicts
[elogind.git] / src / resolve / resolved.c
index 275f99c924fab6de5f4f4b6fb5a1b7ae06d02476..892bb51386d8f27b97323085f6002415db458c86 100644 (file)
 
 #include "sd-event.h"
 #include "sd-daemon.h"
-
-#include "resolved.h"
-
 #include "mkdir.h"
 #include "capability.h"
 
+#include "resolved-manager.h"
+#include "resolved-conf.h"
+
 int main(int argc, char *argv[]) {
         _cleanup_(manager_freep) Manager *m = NULL;
         const char *user = "systemd-resolve";
@@ -55,8 +55,7 @@ int main(int argc, char *argv[]) {
         /* Always create the directory where resolv.conf will live */
         r = mkdir_safe_label("/run/systemd/resolve", 0755, uid, gid);
         if (r < 0) {
-                log_error("Could not create runtime directory: %s",
-                          strerror(-r));
+                log_error("Could not create runtime directory: %s", strerror(-r));
                 goto finish;
         }
 
@@ -74,16 +73,20 @@ int main(int argc, char *argv[]) {
 
         r = manager_parse_config_file(m);
         if (r < 0)
-                return r;
+                log_warning("Failed to parse configuration file: %s", strerror(-r));
 
-        /* write finish default resolv.conf to avoid a dangling
-         * symlink */
-        r = manager_write_resolv_conf(m);
+        r = manager_start(m);
         if (r < 0) {
-                log_error("Could not create resolv.conf: %s", strerror(-r));
+                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);
+        if (r < 0)
+                log_warning("Could not create resolv.conf: %s", strerror(-r));
+
         sd_notify(false,
                   "READY=1\n"
                   "STATUS=Processing requests...");