diff options
author | jilles <jilles@FreeBSD.org> | 2013-10-18 12:35:12 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2013-10-18 12:35:12 +0000 |
commit | 3ccfe0d54448cb218d12f6d0b8057d2afe4b7af1 (patch) | |
tree | a11dc7ead3cb7fcca50ffcf400d9868ca3e32374 /bin | |
parent | 15bf763e722770c678e3ab65e94bc17494c19e1a (diff) | |
download | FreeBSD-src-3ccfe0d54448cb218d12f6d0b8057d2afe4b7af1.zip FreeBSD-src-3ccfe0d54448cb218d12f6d0b8057d2afe4b7af1.tar.gz |
sh: Remove one syscall when waiting for a foreground job.
The getpgrp() call is unnecessary: if there is no job control then the
result was not used at all and if there is job control then we are not a
subshell and our process group ID is equal to our process ID (rootpid).
Diffstat (limited to 'bin')
-rw-r--r-- | bin/sh/jobs.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/bin/sh/jobs.c b/bin/sh/jobs.c index bbb954a..1c0c6bd 100644 --- a/bin/sh/jobs.c +++ b/bin/sh/jobs.c @@ -978,7 +978,6 @@ int waitforjob(struct job *jp, int *origstatus) { #if JOBS - pid_t mypgrp = getpgrp(); int propagate_int = jp->jobctl && jp->foreground; #endif int status; @@ -992,7 +991,7 @@ waitforjob(struct job *jp, int *origstatus) dotrap(); #if JOBS if (jp->jobctl) { - if (tcsetpgrp(ttyfd, mypgrp) < 0) + if (tcsetpgrp(ttyfd, rootpid) < 0) error("tcsetpgrp failed, errno=%d\n", errno); } if (jp->state == JOBSTOPPED) |