From: Lennart Poettering Date: Wed, 8 Nov 2023 12:55:58 +0000 (+0100) Subject: exec-invoke: only reset tty if we are told to X-Git-Tag: v255-rc2~45^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bb2dbe7c6a951baaab5ea8c426d062c7f9823018;p=thirdparty%2Fsystemd.git exec-invoke: only reset tty if we are told to We have a setting for this, honour it also if we are invoked with stdin passed in as fd. Fixes: #29714 --- diff --git a/src/core/exec-invoke.c b/src/core/exec-invoke.c index 627b96d4359..5ba0a471489 100644 --- a/src/core/exec-invoke.c +++ b/src/core/exec-invoke.c @@ -393,7 +393,10 @@ static int setup_input( /* Try to make this the controlling tty, if it is a tty, and reset it */ if (isatty(STDIN_FILENO)) { (void) ioctl(STDIN_FILENO, TIOCSCTTY, context->std_input == EXEC_INPUT_TTY_FORCE); - (void) reset_terminal_fd(STDIN_FILENO, true); + + if (context->tty_reset) + (void) reset_terminal_fd(STDIN_FILENO, /* switch_to_text= */ true); + (void) exec_context_apply_tty_size(context, STDIN_FILENO, /* tty_path= */ NULL); }