summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2013-10-18 12:35:12 +0000
committerjilles <jilles@FreeBSD.org>2013-10-18 12:35:12 +0000
commit3ccfe0d54448cb218d12f6d0b8057d2afe4b7af1 (patch)
treea11dc7ead3cb7fcca50ffcf400d9868ca3e32374 /bin
parent15bf763e722770c678e3ab65e94bc17494c19e1a (diff)
downloadFreeBSD-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.c3
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)
OpenPOWER on IntegriCloud