]> git.ipfire.org Git - thirdparty/systemd.git/commit
basic: update in_first_boot() to return an error 42555/head
authorMichael Vogt <michael@amutable.com>
Fri, 3 Jul 2026 15:28:45 +0000 (17:28 +0200)
committerMichael Vogt <michael@amutable.com>
Thu, 9 Jul 2026 14:48:26 +0000 (16:48 +0200)
commit9d947d0a2afbbf5767e2fc5c82b9e21c20c41120
tree9f6c7af6a0eea7374ce4624ef918ea879e8f9780
parenteb8227c671eed4ea913f9362eefe1dcf9720829a
basic: update in_first_boot() to return an error

This commit tweaks the in_first_boot() code to make it
a proper shared helper. It tweaks the comments about the
caching policy. This is important because while this is
simialr to `in_initrd()` there is a suble difference:
we never cache the result of access() because other parts
of systemd will use this file to signal if anything about
firstboot changes.

This also tweaks it to return an int instead of a bool.
So any error is returned as -errno. This allows other
parts of systemd (like the random-seed) that need to make
decisions about "unknown" first-boot state.

This also means that the consumers need to get updated
and we can now also use the new helper in random-seed-tool.c
and have only a single helper to check for first-boot.
src/basic/initrd-util.c
src/basic/initrd-util.h
src/random-seed/random-seed-tool.c
src/shared/condition.c
src/shared/creds-util.c