mirror of
https://github.com/troglobit/finit.git
synced 2026-11-17 19:30:29 +00:00
plugins/rtc: instead of bailing, reset invalid RTC to kernel default
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
cb2969002c
commit
cd383167f9
1 file changed
+11
-1
+11
-1
@@ -156,8 +156,18 @@ static void rtc_restore(void *arg)
|
|||||||
logit(LOG_ERR, "RTC has no previously saved (valid) time.");
|
logit(LOG_ERR, "RTC has no previously saved (valid) time.");
|
||||||
else
|
else
|
||||||
logit(LOG_ERR, "RTC error code %d: %s", errno, strerror(errno));
|
logit(LOG_ERR, "RTC error code %d: %s", errno, strerror(errno));
|
||||||
|
|
||||||
|
/* Been here already? */
|
||||||
|
if (rc)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
/* Attempt to set RTC to a sane value ... */
|
||||||
|
tv.tv_sec = RTC_TIMESTAMP_BEGIN_2000;
|
||||||
|
if (!gmtime_r(&tv.tv_sec, &tm))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
logit(LOG_NOTICE, "Resetting RTC to kernel default, 2000-01-01 00:00.");
|
||||||
rc = 2;
|
rc = 2;
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print_desc(NULL, "Restoring system clock (UTC) from RTC");
|
print_desc(NULL, "Restoring system clock (UTC) from RTC");
|
||||||
|
|||||||
Reference in new issue
Block a user