]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev: check whether systemd is running, and do not use cg_kill() if not
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 6 Feb 2019 18:34:13 +0000 (19:34 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 13 Feb 2019 16:07:56 +0000 (17:07 +0100)
Fixes #11645.

src/udev/udevd.c

index c637b98c7c7cebbc6ff6a566580ee33dd2f27d36..0303f36b4f2a93f49d6ff6f1cf36364f44ddc45b 100644 (file)
@@ -1798,10 +1798,10 @@ static int run(int argc, char *argv[]) {
 
         dev_setup(NULL, UID_INVALID, GID_INVALID);
 
-        if (getppid() == 1) {
-                /* get our own cgroup, we regularly kill everything udev has left behind
-                   we only do this on systemd systems, and only if we are directly spawned
-                   by PID1. otherwise we are not guaranteed to have a dedicated cgroup */
+        if (getppid() == 1 && sd_booted() > 0) {
+                /* Get our own cgroup, we regularly kill everything udev has left behind.
+                 * We only do this on systemd systems, and only if we are directly spawned
+                 * by PID1. Otherwise we are not guaranteed to have a dedicated cgroup. */
                 r = cg_pid_get_path(SYSTEMD_CGROUP_CONTROLLER, 0, &cgroup);
                 if (r < 0) {
                         if (IN_SET(r, -ENOENT, -ENOMEDIUM))