In non-pty mode before continuing the child, make it the foreground

pgrp if possible.  Fixes resuming a shell.
This commit is contained in:
Todd C. Miller
2011-02-02 14:19:23 -05:00
parent 8a64a8c798
commit 29f9e23c84

View File

@@ -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);
}
}