swclock: Use the same file for both saving and loading #560
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If no path is specified on the command-line when calling
swclock
, it defaults to saving and loading the last shutdown time from a file namedshutdowntime
:openrc/src/swclock/swclock.c
Line 37 in 9380347
I noticed
swclock
wasn't operating as I'd expect on Alpine Linux and went investigating to find that/etc/init.d/swclock
was callingswclock
with no path defined when saving the time:openrc/init.d/swclock.in
Line 34 in 9380347
But providing the path of
@SBINDIR@/openrc-run
when loading the time:openrc/init.d/swclock.in
Line 26 in 9380347
Sure enough I found a file named
/run/openrc/shutdowntime
was being created, though on atmpfs
, and regardless, not being used when loading the time.This PR updates
/etc/init.d/swclock
so the same file is used for both -@SBINDIR@/openrc-run
. I chose this over using the default, as I've noted that systems such as Alpine Linux are placingshutdowntime
in a location backed bytmpfs
.What I am changing hasn't changed in many many years, so either this has been broken for a long time, or I'm misunderstanding how it works, which is entirely possible, apologies if it is the later, I thought a PR rather than Issue would be more worthwhile in-case I am on the right track! 馃槃
Possibly closes #430.