]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/resolve/resolved.c
Merge pull request #2138 from stefwalter/journal-combine
[thirdparty/systemd.git] / src / resolve / resolved.c
index 7d258c9470b3faf8f4bd623118ad128df5eced00..eee52da882fa2ebbd8a35efe0b5e1cb5b2b8c034 100644 (file)
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include "sd-event.h"
 #include "sd-daemon.h"
-#include "mkdir.h"
-#include "label.h"
-#include "capability.h"
+#include "sd-event.h"
 
-#include "resolved-manager.h"
+#include "capability-util.h"
+#include "mkdir.h"
 #include "resolved-conf.h"
+#include "resolved-manager.h"
+#include "resolved-resolv-conf.h"
+#include "selinux-util.h"
+#include "signal-util.h"
+#include "user-util.h"
 
 int main(int argc, char *argv[]) {
         _cleanup_(manager_freep) Manager *m = NULL;
@@ -49,20 +52,20 @@ int main(int argc, char *argv[]) {
 
         r = mac_selinux_init(NULL);
         if (r < 0) {
-                log_error("SELinux setup failed: %s", strerror(-r));
+                log_error_errno(r, "SELinux setup failed: %m");
                 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));
+                log_error_errno(r, "Cannot resolve user name %s: %m", user);
                 goto finish;
         }
 
         /* 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_errno(r, "Could not create runtime directory: %m");
                 goto finish;
         }
 
@@ -70,21 +73,17 @@ int main(int argc, char *argv[]) {
         if (r < 0)
                 goto finish;
 
-        assert_se(sigprocmask_many(SIG_BLOCK, SIGTERM, SIGINT, -1) == 0);
+        assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGTERM, SIGINT, SIGUSR1, -1) >= 0);
 
         r = manager_new(&m);
         if (r < 0) {
-                log_error("Could not create manager: %s", strerror(-r));
+                log_error_errno(r, "Could not create manager: %m");
                 goto finish;
         }
 
-        r = manager_parse_config_file(m);
-        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));
+                log_error_errno(r, "Failed to start manager: %m");
                 goto finish;
         }
 
@@ -92,7 +91,7 @@ int main(int argc, char *argv[]) {
          * symlink */
         r = manager_write_resolv_conf(m);
         if (r < 0)
-                log_warning("Could not create resolv.conf: %s", strerror(-r));
+                log_warning_errno(r, "Could not create "PRIVATE_RESOLV_CONF": %m");
 
         sd_notify(false,
                   "READY=1\n"
@@ -100,7 +99,7 @@ int main(int argc, char *argv[]) {
 
         r = sd_event_loop(m->event);
         if (r < 0) {
-                log_error("Event loop failed: %s", strerror(-r));
+                log_error_errno(r, "Event loop failed: %m");
                 goto finish;
         }
 
@@ -108,7 +107,7 @@ int main(int argc, char *argv[]) {
 
 finish:
         sd_notify(false,
-                  "STOPPIN=1\n"
+                  "STOPPING=1\n"
                   "STATUS=Shutting down...");
 
         return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;