summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2012-07-28 15:13:48 +0000
committerjilles <jilles@FreeBSD.org>2012-07-28 15:13:48 +0000
commit68e92f2ba977bbf5972ee3389ed379fe6e206ce4 (patch)
tree0ac283725d0d9ccf848cac23c5e958484553989d /bin
parentacf68e5eb413ab998079634681a88d35a8a0ff37 (diff)
downloadFreeBSD-src-68e92f2ba977bbf5972ee3389ed379fe6e206ce4.zip
FreeBSD-src-68e92f2ba977bbf5972ee3389ed379fe6e206ce4.tar.gz
sh: Do not ask for stopped/continued processes if we do not need them
rather than retrying wait3 if they happen.
Diffstat (limited to 'bin')
-rw-r--r--bin/sh/jobs.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/bin/sh/jobs.c b/bin/sh/jobs.c
index feb9e1f..a8ed079 100644
--- a/bin/sh/jobs.c
+++ b/bin/sh/jobs.c
@@ -1025,17 +1025,16 @@ dowait(int block, struct job *job)
TRACE(("dowait(%d) called\n", block));
do {
#if JOBS
- wflags = WUNTRACED | WCONTINUED;
-#else
- wflags = 0;
+ if (iflag)
+ wflags = WUNTRACED | WCONTINUED;
+ else
#endif
+ wflags = 0;
if (block == 0)
wflags |= WNOHANG;
pid = wait3(&status, wflags, (struct rusage *)NULL);
TRACE(("wait returns %d, status=%d\n", (int)pid, status));
- } while ((pid == -1 && errno == EINTR && breakwaitcmd == 0) ||
- (pid > 0 && (WIFSTOPPED(status) || WIFCONTINUED(status)) &&
- !iflag));
+ } while (pid == -1 && errno == EINTR && breakwaitcmd == 0);
if (pid == -1 && errno == ECHILD && job != NULL)
job->state = JOBDONE;
if (breakwaitcmd != 0) {
OpenPOWER on IntegriCloud