diff options
author | Patrick Oppenlander <patrick.oppenlander@gmail.com> | 2020-10-15 12:50:40 +1100 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2020-10-15 23:01:52 -0500 |
commit | 55edd44d8f351606b948347c1c78263c054eaf89 (patch) | |
tree | 3ff1e7cae2bf3cd301eced883d97fad12b59a254 | |
parent | 6e331aef7f2ce0c6f905ab099028d8cf8f91b1a0 (diff) | |
download | toybox-55edd44d8f351606b948347c1c78263c054eaf89.tar.gz |
hwclock: default to UTC if /etc/adjtime can't be read
This is consistent with the util-linux implementation.
-rw-r--r-- | toys/other/hwclock.c | 6 |
1 files changed, 2 insertions, 4 deletions
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"; |