aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Oppenlander <patrick.oppenlander@gmail.com>2020-10-15 12:51:10 +1100
committerRob Landley <rob@landley.net>2020-10-15 23:02:30 -0500
commit29229bf0fdebfbc7fe5088a073dd74d0ea57dc3b (patch)
treeb6fe350f8bd78d1d0646d9fc77eef9fd5c9130d0
parent55edd44d8f351606b948347c1c78263c054eaf89 (diff)
downloadtoybox-29229bf0fdebfbc7fe5088a073dd74d0ea57dc3b.tar.gz
rtcwake: default to UTC if /etc/adjtime can't be read
This is consistent with the util-linux implementation.
-rw-r--r--toys/other/rtcwake.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toys/other/rtcwake.c b/toys/other/rtcwake.c
index 161bd881..a382ee57 100644
--- a/toys/other/rtcwake.c
+++ b/toys/other/rtcwake.c
@@ -55,7 +55,7 @@ void rtcwake_main(void)
if (FLAG(u)) utc = 1;
else if (FLAG(l)) utc = 0;
- else utc = !!strstr(xreadfile("/etc/adjtime", toybuf, 2048), "UTC");
+ else utc = !readfile("/etc/adjtime", toybuf, 2048) || !!strstr(toybuf, "UTC");
if (FLAG(v)) xprintf("RTC time: %s\n", utc ? "UTC" : "local");
if (!TT.d) TT.d = "/dev/rtc0";