diff --git a/src/core/execute.c b/src/core/execute.c index 7590943179..6ed2f5a0f9 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -147,8 +147,8 @@ void exec_context_tty_reset(const ExecContext *context, const ExecParameters *p) const char *path = exec_context_tty_path(context); - if (p && p->stdin_fd >= 0 && isatty_safe(p->stdin_fd)) - fd = p->stdin_fd; + if (p && p->stdout_fd >= 0 && isatty_safe(p->stdout_fd)) + fd = p->stdout_fd; else if (path && (context->tty_path || is_terminal_input(context->std_input) || is_terminal_output(context->std_output) || is_terminal_output(context->std_error))) { fd = _fd = open_terminal(path, O_RDWR|O_NOCTTY|O_CLOEXEC|O_NONBLOCK); diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c index 615142cc1e..86aa8e8c18 100644 --- a/src/firstboot/firstboot.c +++ b/src/firstboot/firstboot.c @@ -133,7 +133,7 @@ static void print_welcome(int rfd) { pn = os_release_pretty_name(pretty_name, os_name); ac = isempty(ansi_color) ? "0" : ansi_color; - (void) terminal_reset_defensive(STDIN_FILENO, /* switch_to_text= */ false); + (void) terminal_reset_defensive(STDOUT_FILENO, /* switch_to_text= */ false); if (colors_enabled()) printf("\nWelcome to your new installation of \x1B[%sm%s\x1B[0m!\n", ac, pn); diff --git a/src/home/homectl.c b/src/home/homectl.c index c64354141c..8022694f70 100644 --- a/src/home/homectl.c +++ b/src/home/homectl.c @@ -2438,7 +2438,7 @@ static int create_interactively(void) { (void) polkit_agent_open_if_enabled(arg_transport, arg_ask_password); - (void) terminal_reset_defensive(STDIN_FILENO, /* switch_to_text= */ false); + (void) terminal_reset_defensive(STDOUT_FILENO, /* switch_to_text= */ false); for (;;) { username = mfree(username); diff --git a/src/test/test-terminal-util.c b/src/test/test-terminal-util.c index e7cfeab6d0..68b9cbe606 100644 --- a/src/test/test-terminal-util.c +++ b/src/test/test-terminal-util.c @@ -286,7 +286,7 @@ TEST(get_color_mode) { TEST(terminal_reset_defensive) { int r; - r = terminal_reset_defensive(STDIN_FILENO, /* switch_to_text= */ false); + r = terminal_reset_defensive(STDOUT_FILENO, /* switch_to_text= */ false); if (r < 0) log_notice_errno(r, "Failed to reset terminal: %m"); }