chiark / gitweb /
password-agent: actually really don't access unallocated memory
[elogind.git] / src / main.c
index 11379f6bb434f0abc33c5fca04611ac7522170e2..76a094383237922510da0658b9b8971feced3896 100644 (file)
@@ -1033,6 +1033,8 @@ int main(int argc, char *argv[]) {
 
         program_invocation_short_name = systemd;
         prctl(PR_SET_NAME, systemd);
+        saved_argv = argv;
+        saved_argc = argc;
 
         log_show_color(isatty(STDERR_FILENO) > 0);
         log_show_location(false);
@@ -1050,15 +1052,18 @@ int main(int argc, char *argv[]) {
                 if (label_init() < 0)
                         goto finish;
 
-                if (hwclock_is_localtime()) {
+                if (hwclock_is_localtime() > 0) {
                         int min;
 
                         min = hwclock_apply_localtime_delta();
-                        log_info("Hwclock configured in localtime, applying delta of %i minutes to system time", min);
+                        if (min < 0)
+                                log_error("Failed to apply local time delta: %s", strerror(-min));
+                        else
+                                log_info("RTC configured in localtime, applying delta of %i minutes to system time.", min);
                 }
         } else {
                 arg_running_as = MANAGER_USER;
-                log_set_target(LOG_TARGET_CONSOLE);
+                log_set_target(LOG_TARGET_AUTO);
         }
 
         if (set_default_unit(SPECIAL_DEFAULT_TARGET) < 0)