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).
This commit is contained in:
parent
a9355dbe82
commit
bab2982266
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user