diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-04-23 04:06:23 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-04-23 04:06:23 +0200 |
commit | 2146621ba3812a78e2f0f589776f1bc4cce07d34 (patch) | |
tree | e62a006738184f8284705064c3da87b537db1665 /main.c | |
parent | 77a38d306922b3e980c06a3a377b344ea429edd7 (diff) |
main: never reset console unless pid=1, to make sure that we don't kill X when somebody passes --test
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -164,7 +164,7 @@ static void install_crash_handler(void) { assert_se(sigaction(SIGABRT, &sa, NULL) == 0); } -static int console_setup(void) { +static int console_setup(bool do_reset) { int tty_fd = -1, null_fd = -1, r = 0; /* If we are init, we connect stdout/stderr to /dev/console @@ -188,8 +188,9 @@ static int console_setup(void) { assert(tty_fd >= 3); assert(null_fd >= 3); - if (reset_terminal(tty_fd) < 0) - log_error("Failed to reset /dev/console: %m"); + if (do_reset) + if (reset_terminal(tty_fd) < 0) + log_error("Failed to reset /dev/console: %m"); if (dup2(tty_fd, STDOUT_FILENO) < 0 || dup2(tty_fd, STDERR_FILENO) < 0 || @@ -612,8 +613,10 @@ int main(int argc, char *argv[]) { umask(0); } + /* Reset the console, but only if this is really init and we + * are freshly booted */ if (running_as == MANAGER_INIT) - console_setup(); + console_setup(getpid() == 1 && !serialization); /* Make sure D-Bus doesn't fiddle with the SIGPIPE handlers */ dbus_connection_set_change_sigpipe(FALSE); |