diff options
author | Todd C. Miller <Todd.Miller@sudo.ws> | 2023-03-22 11:21:15 -0600 |
---|---|---|
committer | Todd C. Miller <Todd.Miller@sudo.ws> | 2023-03-22 11:21:15 -0600 |
commit | 301ef62d7254c69d0c2e5180e49862ae20c97c49 (patch) | |
tree | 1ae3cf72bdf4347244d6e4ebb6198ef7931afc0b | |
parent | c5b88273fb26829d3ba788c7bfcc13bfb0e0543f (diff) | |
download | sudo-301ef62d7254c69d0c2e5180e49862ae20c97c49.tar.gz |
check_foreground: use SFD_LEADER not SFD_FOLLOWER (which was closed).
Also use SFD_LEADER for sudo_term_copy() in exec_pty() for consistency.
From Duncan Overbruck.
-rw-r--r-- | src/exec_pty.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/exec_pty.c b/src/exec_pty.c index 029f42360..4ca44b814 100644 --- a/src/exec_pty.c +++ b/src/exec_pty.c @@ -161,7 +161,8 @@ check_foreground(struct exec_closure *ec) if ((ret = tcgetpgrp(io_fds[SFD_USERTTY])) != -1) { foreground = ret == ec->ppgrp; if (foreground && !tty_initialized) { - if (sudo_term_copy(io_fds[SFD_USERTTY], io_fds[SFD_FOLLOWER])) + /* Lazily initialize the pty if needed. */ + if (sudo_term_copy(io_fds[SFD_USERTTY], io_fds[SFD_LEADER])) tty_initialized = true; } @@ -1233,8 +1234,8 @@ exec_pty(struct command_details *details, struct command_status *cstat) } if (foreground) { - /* Copy terminal attrs from user tty -> pty follower. */ - if (!sudo_term_copy(io_fds[SFD_USERTTY], io_fds[SFD_FOLLOWER])) { + /* Copy terminal attrs from user tty -> pty. */ + if (!sudo_term_copy(io_fds[SFD_USERTTY], io_fds[SFD_LEADER])) { sudo_debug_printf(SUDO_DEBUG_ERROR|SUDO_DEBUG_ERRNO, "%s: unable to copy terminal settings to pty", __func__); foreground = false; |