]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemd-notify: Fix return value of --booted
authorJoerg Behrmann <behrmann@physik.fu-berlin.de>
Tue, 30 Mar 2021 14:29:59 +0000 (16:29 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Thu, 1 Apr 2021 19:42:22 +0000 (20:42 +0100)
src/notify/notify.c

index 40cbc296bd516d05f47743d9eb261eabced4da2d..99f54ceaaab609d8c3b1bd0f24c88c4d91af2e96 100644 (file)
@@ -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);