From c298f15888021559b7e2b3fd837cf34d24fa428d Mon Sep 17 00:00:00 2001 From: macmpi <16296055+macmpi@users.noreply.github.com> Date: Fri, 8 Dec 2023 16:21:26 +0100 Subject: [PATCH] init.d/swclock: use current time instead of default reference file A default reference file mtime may send the clock backwards of current deptree mtime. Fixes https://github.com/OpenRC/openrc/issues/675 --- init.d/swclock.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/init.d/swclock.in b/init.d/swclock.in index 63c052d1e..b9814150b 100644 --- a/init.d/swclock.in +++ b/init.d/swclock.in @@ -24,7 +24,9 @@ start() { ebegin "Setting the local clock based on last shutdown time" if ! swclock "${swclock_file}" 2> /dev/null; then - swclock --warn @SBINDIR@/openrc-run + local curr_mtime="$(mktemp -q)" + swclock --warn "${curr_mtime}" + rm -f "${curr_mtime}" fi eend $? }