Browse Source

Only re-open stdin/out/err if we are system manager

If we're not PID 1, dinit may be being executed by mistake (instead of
dinitctl). We need any error messages to be displayed before exiting, in
this case, to the current error stream.
Davin McCall 2 years ago
parent
commit
abdf7ac4a2
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/dinit.cc

+ 2 - 2
src/dinit.cc

@@ -367,8 +367,8 @@ int dinit_main(int argc, char **argv)
             return 1;
         }
     }
-    
-    if (am_system_init) {
+
+    if (am_system_mgr) {
         // setup STDIN, STDOUT, STDERR so that we can use them
         int onefd = open("/dev/console", O_RDONLY, 0);
         if (onefd != -1) {