From: Todd C. Miller Date: Wed, 2 Feb 2011 19:26:41 +0000 (-0500) Subject: In non-pty mode before continuing the child, make it the foreground X-Git-Tag: SUDO_1_7_5~38 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8020b162e164c44fe758e5c2197e56225fb2955a;p=sudo In non-pty mode before continuing the child, make it the foreground pgrp if possible. Fixes resuming a shell. --HG-- branch : 1.7 --- diff --git a/exec.c b/exec.c index d9c3608b0..4b402213d 100644 --- a/exec.c +++ b/exec.c @@ -498,6 +498,18 @@ handle_signals(fd, child, cstat) } else #endif { + 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); + } + } /* Nothing listening on sv[0], send directly. */ kill(child, signo); }