summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-02-06 19:34:13 +0100
committerLennart Poettering <lennart@poettering.net>2019-02-13 17:07:56 +0100
commit31cbd2025359e1e8435a2dc371e439591846d8c4 (patch)
tree6b0585038e9a7c0e329680feeed4f08a7550bf12
parenteb80dbd24b8ed3fd5621b7f82904d2cb2a042737 (diff)
downloadsystemd-31cbd2025359e1e8435a2dc371e439591846d8c4.tar.gz
udev: check whether systemd is running, and do not use cg_kill() if not
Fixes #11645.
-rw-r--r--src/udev/udevd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index c637b98c7c..0303f36b4f 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -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))