chiark / gitweb /
treewide: auto-convert the simple cases to log_*_errno()
[elogind.git] / src / timesync / timesyncd.c
index 351bfd0236de4437b216ec61667e6272645aa246..b5a521f6725a28b979a2f80975fb72b138c9e56c 100644 (file)
@@ -101,7 +101,7 @@ int main(int argc, char *argv[]) {
 
         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;
         }
 
@@ -117,7 +117,7 @@ int main(int argc, char *argv[]) {
 
         r = manager_new(&m);
         if (r < 0) {
-                log_error("Failed to allocate manager: %s", strerror(-r));
+                log_error_errno(-r, "Failed to allocate manager: %m");
                 goto finish;
         }
 
@@ -129,10 +129,12 @@ int main(int argc, char *argv[]) {
 
         r = manager_parse_config_file(m);
         if (r < 0)
-                log_warning("Failed to parse configuration file: %s", strerror(-r));
+                log_warning_errno(-r, "Failed to parse configuration file: %m");
 
         log_debug("systemd-timesyncd running as pid %lu", (unsigned long) getpid());
-        sd_notify(false, "READY=1");
+        sd_notify(false,
+                  "READY=1\n"
+                  "STATUS=Daemon is running");
 
         if (network_is_online()) {
                 r = manager_connect(m);
@@ -142,7 +144,7 @@ int main(int argc, char *argv[]) {
 
         r = sd_event_loop(m->event);
         if (r < 0) {
-                log_error("Failed to run event loop: %s", strerror(-r));
+                log_error_errno(-r, "Failed to run event loop: %m");
                 goto finish;
         }
 
@@ -153,7 +155,9 @@ int main(int argc, char *argv[]) {
         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;
 }