diff options
Diffstat (limited to '')
-rw-r--r-- | src/jobs.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/jobs.c b/src/jobs.c index b1ab7ab..a4fada0 100644 --- a/src/jobs.c +++ b/src/jobs.c @@ -189,17 +189,15 @@ setjobctl(int on) if (on == jobctl || rootshell == 0) return; if (on) { - fd = open(_PATH_TTY, O_RDWR); + int ofd; + ofd = fd = open(_PATH_TTY, O_RDWR); if (fd < 0) { fd += 3; while (!isatty(fd)) if (--fd < 0) goto out; - fd = dup(fd); - if (fd < 0) - goto out; } - fd = savefd(fd); + fd = savefd(fd, ofd); do { /* while we are in the background */ if ((pgrp = tcgetpgrp(fd)) < 0) { out: |