mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-22 01:49:11 +00:00
Work around a macOS a kernel bug where tcsetpgrp() does not restart.
I reported this bug to Apple over 12 years ago.
This commit is contained in:
parent
be20e1592f
commit
4d417b46d9
@ -983,12 +983,19 @@ run_command(const char *path, char *const *argv)
|
||||
* (suspending visudo itself if running in the background).
|
||||
*/
|
||||
if (ttyfd != -1) {
|
||||
retry:
|
||||
if (tcsetpgrp(ttyfd, pid) == 0) {
|
||||
sudo_debug_printf(SUDO_DEBUG_DIAG, "%s: %d: continuing",
|
||||
__func__, (int)pid);
|
||||
killpg(pid, SIGCONT);
|
||||
break;
|
||||
} else {
|
||||
/*
|
||||
* macOS suffers from a kernel bug where tcsetpgrp()
|
||||
* is not restarted so we have to do it manually.
|
||||
*/
|
||||
if (errno == EINTR && tcgetpgrp(ttyfd) == visudo_pgrp)
|
||||
goto retry;
|
||||
sudo_debug_printf(SUDO_DEBUG_ERROR|SUDO_DEBUG_ERRNO,
|
||||
"%s: unable to set foreground pgrp to %d (visudo)",
|
||||
__func__, (int)visudo_pgrp);
|
||||
|
Loading…
x
Reference in New Issue
Block a user