From 29229bf0fdebfbc7fe5088a073dd74d0ea57dc3b Mon Sep 17 00:00:00 2001 From: Patrick Oppenlander Date: Thu, 15 Oct 2020 12:51:10 +1100 Subject: rtcwake: default to UTC if /etc/adjtime can't be read This is consistent with the util-linux implementation. --- toys/other/rtcwake.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'toys/other') 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"; -- cgit v1.2.3