Harald Hoyer 1a6f5e
From c1dae1b3c9729fb8ab749dd4e2dad07e0fad7ed8 Mon Sep 17 00:00:00 2001
Harald Hoyer 1a6f5e
From: Lennart Poettering <lennart@poettering.net>
Harald Hoyer 1a6f5e
Date: Thu, 14 Mar 2013 21:36:38 +0100
Harald Hoyer 1a6f5e
Subject: [PATCH] main: don't mount /sys, /dev and friends when we run with PID
Harald Hoyer 1a6f5e
 != 1
Harald Hoyer 1a6f5e
Harald Hoyer 1a6f5e
Back from old times when we developed systemd on non-systemd hosts we
Harald Hoyer 1a6f5e
still mounted the missing directories such as the cgroup stuff even when
Harald Hoyer 1a6f5e
running with a PID != 1. There's no point for that anymore, so let's
Harald Hoyer 1a6f5e
just do that if we are actually PID 1, and never otherwise.
Harald Hoyer 1a6f5e
Harald Hoyer 1a6f5e
https://bugs.freedesktop.org/show_bug.cgi?id=62354
Harald Hoyer 1a6f5e
---
Harald Hoyer 1a6f5e
 src/core/main.c | 2 +-
Harald Hoyer 1a6f5e
 1 file changed, 1 insertion(+), 1 deletion(-)
Harald Hoyer 1a6f5e
Harald Hoyer 1a6f5e
diff --git a/src/core/main.c b/src/core/main.c
Harald Hoyer 1a6f5e
index 7b03983..01a6d41 100644
Harald Hoyer 1a6f5e
--- a/src/core/main.c
Harald Hoyer 1a6f5e
+++ b/src/core/main.c
Harald Hoyer 1a6f5e
@@ -1437,7 +1437,7 @@ int main(int argc, char *argv[]) {
Harald Hoyer 1a6f5e
 
Harald Hoyer 1a6f5e
         /* Mount /proc, /sys and friends, so that /proc/cmdline and
Harald Hoyer 1a6f5e
          * /proc/$PID/fd is available. */
Harald Hoyer 1a6f5e
-        if (geteuid() == 0 && !getenv("SYSTEMD_SKIP_API_MOUNTS")) {
Harald Hoyer 1a6f5e
+        if (getpid() == 1) {
Harald Hoyer 1a6f5e
                 r = mount_setup(loaded_policy);
Harald Hoyer 1a6f5e
                 if (r < 0)
Harald Hoyer 1a6f5e
                         goto finish;
Harald Hoyer 1a6f5e
-- 
Harald Hoyer 1a6f5e
1.8.1
Harald Hoyer 1a6f5e