From 55edd44d8f351606b948347c1c78263c054eaf89 Mon Sep 17 00:00:00 2001 From: Patrick Oppenlander Date: Thu, 15 Oct 2020 12:50:40 +1100 Subject: hwclock: default to UTC if /etc/adjtime can't be read This is consistent with the util-linux implementation. --- toys/other/hwclock.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'toys/other') diff --git a/toys/other/hwclock.c b/toys/other/hwclock.c index ba28cc3d..a6db923a 100644 --- a/toys/other/hwclock.c +++ b/toys/other/hwclock.c @@ -40,10 +40,8 @@ void hwclock_main() if (FLAG(u)) utc = 1; else if (FLAG(l)) utc = 0; - else { - xreadfile("/etc/adjtime", toybuf, sizeof(toybuf)); - utc = !!strstr(toybuf, "UTC"); - } + else utc = !readfile("/etc/adjtime", toybuf, sizeof(toybuf)) || + !!strstr(toybuf, "UTC"); if (!FLAG(t)) { if (!TT.f) TT.f = "/dev/rtc0"; -- cgit v1.2.3