From: Paul Eggert Date: Tue, 21 May 2024 22:49:40 +0000 (-0700) Subject: boot-time: port to Alpine 3.20.0_rc2 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=ce9fdb27f0fe30f1476465bb21a162dcd1c84a23;p=gnulib.git boot-time: port to Alpine 3.20.0_rc2 * lib/boot-time-aux.h (get_openbsd_boot_time): Port to Alpine Linux, which had bogus timestamps on /var/run/utmp. --- diff --git a/ChangeLog b/ChangeLog index dd5dd8c2a2..2c0e56722f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2024-05-21 Paul Eggert + + boot-time: port to Alpine 3.20.0_rc2 + * lib/boot-time-aux.h (get_openbsd_boot_time): + Port to Alpine Linux, which had bogus timestamps on /var/run/utmp. + 2024-05-20 Bruno Haible vasnprintf: Don't abort for pseudo-denormal arguments on macOS 12. diff --git a/lib/boot-time-aux.h b/lib/boot-time-aux.h index 7f8c5405e4..b1add30239 100644 --- a/lib/boot-time-aux.h +++ b/lib/boot-time-aux.h @@ -108,8 +108,16 @@ get_linux_boot_time_fallback (struct timespec *p_boot_time) struct stat statbuf; if (stat (filename, &statbuf) >= 0) { - *p_boot_time = get_stat_mtime (&statbuf); - return 0; + struct timespec boot_time = get_stat_mtime (&statbuf); + /* On Alpine 3.20.0_rc2 /var/run/utmp was observed with bogus + timestamps of ~10 s. Reject timestamps before + 2005-07-25 23:34:15 UTC (1122334455), as neither Alpine + nor Devuan existed then. */ + if (boot_time.tv_sec >= 1122334455) + { + *p_boot_time = boot_time; + return 0; + } } } return -1;