summaryrefslogtreecommitdiff
path: root/src/notify
diff options
context:
space:
mode:
authorJoerg Behrmann <behrmann@physik.fu-berlin.de>2021-03-30 16:29:59 +0200
committerLuca Boccassi <luca.boccassi@gmail.com>2021-04-01 20:42:22 +0100
commit8ab34a49dbf75fd731973359a6f24c212682f479 (patch)
treec7031e410022dcc54bdb9db13baba77fad282df5 /src/notify
parent28a9744673e438ac06db7c75159b60d7322f0897 (diff)
downloadsystemd-8ab34a49dbf75fd731973359a6f24c212682f479.tar.gz
systemd-notify: Fix return value of --booted
Diffstat (limited to 'src/notify')
-rw-r--r--src/notify/notify.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/notify/notify.c b/src/notify/notify.c
index 40cbc296bd..99f54ceaaa 100644
--- a/src/notify/notify.c
+++ b/src/notify/notify.c
@@ -202,8 +202,15 @@ static int run(int argc, char* argv[]) {
if (r <= 0)
return r;
- if (arg_booted)
- return sd_booted() <= 0;
+ if (arg_booted) {
+ r = sd_booted();
+ if (r < 0)
+ log_debug_errno(r, "Failed to determine whether we are booted with systemd, assuming we aren't: %m");
+ else
+ log_debug("The system %s booted with systemd.", r ? "was" : "was not");
+
+ return r <= 0;
+ }
if (arg_ready)
our_env[i++] = (char*) "READY=1";
@@ -278,4 +285,4 @@ static int run(int argc, char* argv[]) {
return 0;
}
-DEFINE_MAIN_FUNCTION(run);
+DEFINE_MAIN_FUNCTION_WITH_POSITIVE_FAILURE (run);