mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-29 05:17:54 +00:00
In non-pty mode before continuing the child, make it the foreground
pgrp if possible. Fixes resuming a shell.
This commit is contained in:
parent
8a64a8c798
commit
29f9e23c84
12
src/exec.c
12
src/exec.c
@ -456,6 +456,18 @@ handle_signals(int fd, pid_t child, int log_io, struct command_status *cstat)
|
||||
if (signo == SIGALRM) {
|
||||
terminate_child(child, FALSE);
|
||||
} else {
|
||||
if (signo == SIGCONT) {
|
||||
/*
|
||||
* Before continuing the child, make it the foreground
|
||||
* pgrp if possible. Fixes resuming a shell.
|
||||
*/
|
||||
int fd = open(_PATH_TTY, O_RDWR|O_NOCTTY, 0);
|
||||
if (fd != -1) {
|
||||
if (tcgetpgrp(fd) == getpgrp())
|
||||
(void)tcsetpgrp(fd, child);
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
kill(child, signo);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user