]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/core/shutdown.c
Add SPDX license identifiers to source files under the LGPL
[thirdparty/systemd.git] / src / core / shutdown.c
index a795d875bb6225938b9a3d1ae80f93bf709a6a40..04494f4eee4b3c0f7f1574560d1ea42d8a41e896 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
 /***
   This file is part of systemd.
 
@@ -32,6 +33,7 @@
 #include "alloc-util.h"
 #include "cgroup-util.h"
 #include "def.h"
+#include "exec-util.h"
 #include "fileio.h"
 #include "killall.h"
 #include "log.h"
@@ -179,7 +181,7 @@ int main(int argc, char *argv[]) {
 
         umask(0022);
 
-        if (getpid() != 1) {
+        if (getpid_cached() != 1) {
                 log_error("Not executed by init (PID 1).");
                 r = -EPERM;
                 goto error;
@@ -321,7 +323,7 @@ int main(int argc, char *argv[]) {
         arguments[0] = NULL;
         arguments[1] = arg_verb;
         arguments[2] = NULL;
-        execute_directories(dirs, DEFAULT_TIMEOUT_USEC, arguments);
+        execute_directories(dirs, DEFAULT_TIMEOUT_USEC, NULL, NULL, arguments);
 
         if (!in_container && !in_initrd() &&
             access("/run/initramfs/shutdown", X_OK) == 0) {
@@ -402,7 +404,7 @@ int main(int argc, char *argv[]) {
                         _cleanup_free_ char *param = NULL;
 
                         r = read_one_line_file("/run/systemd/reboot-param", &param);
-                        if (r < 0)
+                        if (r < 0 && r != -ENOENT)
                                 log_warning_errno(r, "Failed to read reboot parameter file: %m");
 
                         if (!isempty(param)) {