]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
exec-invoke: only reset tty if we are told to
authorLennart Poettering <lennart@poettering.net>
Wed, 8 Nov 2023 12:55:58 +0000 (13:55 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 10 Nov 2023 20:38:26 +0000 (21:38 +0100)
We have a setting for this, honour it also if we are invoked with
stdin passed in as fd.

Fixes: #29714
src/core/exec-invoke.c

index 627b96d435923dc00231158730bd5d2d8084ff1c..5ba0a471489aff7922b705bcb328e92fe0708d29 100644 (file)
@@ -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);
                 }