From 2e5b97c8b218f5a5d6fbba0df4166f37ef92c05c Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sat, 22 Apr 2023 15:30:29 +0200 Subject: [PATCH] plugins: check explicitly for (time_t)-1 from mktime() Found by Coverity Scan. Signed-off-by: Joachim Wiberg --- plugins/rtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/rtc.c b/plugins/rtc.c index a749e174..52dbaf87 100644 --- a/plugins/rtc.c +++ b/plugins/rtc.c @@ -183,7 +183,7 @@ static void rtc_restore(void *arg) print_desc(NULL, "Restoring system clock (UTC) from RTC"); tm.tm_isdst = -1; /* Use tzdata to figure it out, please. */ tv.tv_sec = mktime(&tm); - if (tv.tv_sec < rtc_date_fallback) { + if (tv.tv_sec == (time_t)-1 || tv.tv_sec < rtc_date_fallback) { errno = EINVAL; goto invalid; }