[systemd-devel] [PATCH] fix bogus boot error message

Kelly Anderson kelly at silka.with-linux.com
Tue Jul 19 04:22:28 PDT 2011


Hey,

The following commit introduces a bogus error message on boot since 
localtime may be a negative number, i.e. GMT-7.

commit 2076cf883110bd6fc0f87b619005baf2117d6b95
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Jun 16 21:52:11 2011 +0200

     timedated: sync clock down to RTC where necessary


The following patch just uses errno directly rather than using it 
indirectly through
hwclock_apply_localtime_delta():

--- ./src/main.c.orig    2011-07-11 20:07:58.000000000 -0600
+++ ./src/main.c    2011-07-19 05:08:50.905067546 -0600
@@ -1058,9 +1058,10 @@ int main(int argc, char *argv[]) {
                  if (hwclock_is_localtime() > 0) {
                          int min;

+                        errno = 0;
                          min = hwclock_apply_localtime_delta();
-                        if (min < 0)
-                                log_error("Failed to apply local time 
delta: %s", strerror(-min));
+                        if (errno)
+                                log_error("Failed to apply local time 
delta: %s", strerror(errno));
                          else
                                  log_info("RTC configured in localtime, 
applying delta of %i minutes to system time.", min);
                  }



More information about the systemd-devel mailing list