summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-daemon
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-02-06 19:07:34 +0100
committerLennart Poettering <lennart@poettering.net>2019-02-07 14:44:44 +0100
commit21042737f0686bc27dc620da53d11de072579924 (patch)
treea4d523e0d5423fc1f1a906ff913365d9f2539484 /src/libsystemd/sd-daemon
parente327272d795453f68a4c30ba21eb0e887516cf68 (diff)
downloadsystemd-21042737f0686bc27dc620da53d11de072579924.tar.gz
sd-daemon: make sd_booted() return negative errno on unexpected error
Diffstat (limited to 'src/libsystemd/sd-daemon')
-rw-r--r--src/libsystemd/sd-daemon/sd-daemon.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libsystemd/sd-daemon/sd-daemon.c b/src/libsystemd/sd-daemon/sd-daemon.c
index 218210f234..9e8f0a73f5 100644
--- a/src/libsystemd/sd-daemon/sd-daemon.c
+++ b/src/libsystemd/sd-daemon/sd-daemon.c
@@ -604,7 +604,13 @@ _public_ int sd_booted(void) {
* created. This takes place in mount-setup.c, so is
* guaranteed to happen very early during boot. */
- return laccess("/run/systemd/system/", F_OK) >= 0;
+ if (laccess("/run/systemd/system/", F_OK) >= 0)
+ return true;
+
+ if (errno == ENOENT)
+ return false;
+
+ return -errno;
}
_public_ int sd_watchdog_enabled(int unset_environment, uint64_t *usec) {