]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: Debug log if we cannot change the controlling terminal
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 6 Mar 2025 19:26:07 +0000 (20:26 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 7 Mar 2025 09:37:26 +0000 (10:37 +0100)
src/core/exec-invoke.c

index f952079a5275ceb7bbb8c1ddb5fd9782b254be35..2cee136feeb074d195f2dbf198c484dc9a2cb058 100644 (file)
@@ -351,9 +351,9 @@ static int setup_input(
                 if (dup2(params->stdin_fd, STDIN_FILENO) < 0)
                         return -errno;
 
-                /* Try to make this the controlling tty, if it is a tty */
-                if (isatty_safe(STDIN_FILENO))
-                        (void) ioctl(STDIN_FILENO, TIOCSCTTY, context->std_input == EXEC_INPUT_TTY_FORCE);
+                /* Try to make this our controlling tty, if it is a tty */
+                if (isatty_safe(STDIN_FILENO) && ioctl(STDIN_FILENO, TIOCSCTTY, context->std_input == EXEC_INPUT_TTY_FORCE) < 0)
+                        log_debug_errno(errno, "Failed to make standard input TTY our controlling terminal: %m");
 
                 return STDIN_FILENO;
         }