chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
main: never reset console unless pid=1, to make sure that we don't kill X when somebo...
[elogind.git]
/
main.c
diff --git
a/main.c
b/main.c
index 06ad42959bc8b057d0da9537d3f77db41e95ee39..0aa3796e878755fe3bce4df60f508c8d69fe9870 100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-164,7
+164,7
@@
static void install_crash_handler(void) {
assert_se(sigaction(SIGABRT, &sa, NULL) == 0);
}
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
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);
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 ||
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);
}
umask(0);
}
+ /* Reset the console, but only if this is really init and we
+ * are freshly booted */
if (running_as == MANAGER_INIT)
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);
/* Make sure D-Bus doesn't fiddle with the SIGPIPE handlers */
dbus_connection_set_change_sigpipe(FALSE);