sd-daemon: make sd_booted() return negative errno on unexpected error

This commit is contained in:
Yu Watanabe
2019-02-07 14:44:44 +01:00
committed by Lennart Poettering
parent e327272d79
commit 21042737f0
+7 -1
View File
@@ -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) {