From 8020b162e164c44fe758e5c2197e56225fb2955a Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Wed, 2 Feb 2011 14:26:41 -0500 Subject: [PATCH] In non-pty mode before continuing the child, make it the foreground pgrp if possible. Fixes resuming a shell. --HG-- branch : 1.7 --- exec.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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); } -- 2.40.0