chiark / gitweb /
main: don't mount /sys, /dev and friends when we run with PID != 1
authorLennart Poettering <lennart@poettering.net>
Thu, 14 Mar 2013 20:36:38 +0000 (21:36 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 14 Mar 2013 20:39:07 +0000 (21:39 +0100)
Back from old times when we developed systemd on non-systemd hosts we
still mounted the missing directories such as the cgroup stuff even when
running with a PID != 1. There's no point for that anymore, so let's
just do that if we are actually PID 1, and never otherwise.

https://bugs.freedesktop.org/show_bug.cgi?id=62354

src/core/main.c

index 7b039835a8cffe03f38164150c1c9b645a6ddfad..01a6d41fb4c7d9ade192db5acfb76c5c5e443640 100644 (file)
@@ -1437,7 +1437,7 @@ int main(int argc, char *argv[]) {
 
         /* Mount /proc, /sys and friends, so that /proc/cmdline and
          * /proc/$PID/fd is available. */
-        if (geteuid() == 0 && !getenv("SYSTEMD_SKIP_API_MOUNTS")) {
+        if (getpid() == 1) {
                 r = mount_setup(loaded_policy);
                 if (r < 0)
                         goto finish;