chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b80f194
)
hwclock: do not seal the kernel's time-warp call from inside the initrd
author
Kay Sievers
<kay@vrfy.org>
Sat, 27 Oct 2012 14:23:32 +0000
(16:23 +0200)
committer
Kay Sievers
<kay@vrfy.org>
Sat, 27 Oct 2012 14:31:10 +0000
(16:31 +0200)
src/core/main.c
patch
|
blob
|
history
src/shared/hwclock.c
patch
|
blob
|
history
diff --git
a/src/core/main.c
b/src/core/main.c
index e094efeb3c5efb4f9a74587b75cb199a3c75061b..4da8ecb86453d8336e998f1c400b34dc3ab74f54 100644
(file)
--- a/
src/core/main.c
+++ b/
src/core/main.c
@@
-1350,8
+1350,15
@@
int main(int argc, char *argv[]) {
log_error("Failed to apply local time delta, ignoring: %s", strerror(-r));
else
log_info("RTC configured in localtime, applying delta of %i minutes to system time.", min);
log_error("Failed to apply local time delta, ignoring: %s", strerror(-r));
else
log_info("RTC configured in localtime, applying delta of %i minutes to system time.", min);
- } else {
- /* Do dummy first-time call to seal the kernel's time warp magic */
+ } else if (!in_initrd()) {
+ /*
+ * Do dummy first-time call to seal the kernel's time warp magic
+ *
+ * Do not call this this from inside the initrd. The initrd might not
+ * carry /etc/adjtime with LOCAL, but the real system could be set up
+ * that way. In such case, we need to delay the time-warp or the sealing
+ * until we reach the real system.
+ */
hwclock_reset_timezone();
/* Tell the kernel our time zone */
hwclock_reset_timezone();
/* Tell the kernel our time zone */
diff --git
a/src/shared/hwclock.c
b/src/shared/hwclock.c
index 0e8fa45971325704640a701af5666d8e50c76684..f9adf0369ea71cc38f23315b43b57d8b66a2dc08 100644
(file)
--- a/
src/shared/hwclock.c
+++ b/
src/shared/hwclock.c
@@
-199,14
+199,14
@@
int hwclock_set_timezone(int *min) {
const struct timeval *tv_null = NULL;
struct timespec ts;
struct tm *tm;
const struct timeval *tv_null = NULL;
struct timespec ts;
struct tm *tm;
- int minutes
west
;
+ int minutes
delta
;
struct timezone tz;
assert_se(clock_gettime(CLOCK_REALTIME, &ts) == 0);
assert_se(tm = localtime(&ts.tv_sec));
struct timezone tz;
assert_se(clock_gettime(CLOCK_REALTIME, &ts) == 0);
assert_se(tm = localtime(&ts.tv_sec));
- minutes
west
= tm->tm_gmtoff / 60;
+ minutes
delta
= tm->tm_gmtoff / 60;
- tz.tz_minuteswest = -minutes
west
;
+ tz.tz_minuteswest = -minutes
delta
;
tz.tz_dsttime = 0; /* DST_NONE*/
/*
tz.tz_dsttime = 0; /* DST_NONE*/
/*
@@
-217,7
+217,7
@@
int hwclock_set_timezone(int *min) {
if (settimeofday(tv_null, &tz) < 0)
return -errno;
if (min)
if (settimeofday(tv_null, &tz) < 0)
return -errno;
if (min)
- *min = minutes
west
;
+ *min = minutes
delta
;
return 0;
}
return 0;
}