summaryrefslogtreecommitdiffstats
path: root/usr.bin/script/script.c
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>2010-05-06 17:37:23 +0000
committermckusick <mckusick@FreeBSD.org>2010-05-06 17:37:23 +0000
commitb25e55dcc52d6203a9ae995ca470a66b6483f71d (patch)
tree781f2c991a11a3806fdb0891b7a615cb77ebe3ab /usr.bin/script/script.c
parent3a0f5972a0de87aebef1af257922515700da4217 (diff)
parentf3856c6cf2fb115757967b7e32bdeb21bd27d1ee (diff)
downloadFreeBSD-src-b25e55dcc52d6203a9ae995ca470a66b6483f71d.zip
FreeBSD-src-b25e55dcc52d6203a9ae995ca470a66b6483f71d.tar.gz
Final update to current version of head in preparation for reintegration.
Diffstat (limited to 'usr.bin/script/script.c')
-rw-r--r--usr.bin/script/script.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/usr.bin/script/script.c b/usr.bin/script/script.c
index 6c4e0ee..a21785a 100644
--- a/usr.bin/script/script.c
+++ b/usr.bin/script/script.c
@@ -219,23 +219,17 @@ usage(void)
void
finish(void)
{
- pid_t pid;
- int die, e, status;
+ int e, status;
- die = e = 0;
- while ((pid = wait3(&status, WNOHANG, 0)) > 0)
- if (pid == child) {
- die = 1;
- if (WIFEXITED(status))
- e = WEXITSTATUS(status);
- else if (WIFSIGNALED(status))
- e = WTERMSIG(status);
- else /* can't happen */
- e = 1;
- }
-
- if (die)
+ if (waitpid(child, &status, 0) == child) {
+ if (WIFEXITED(status))
+ e = WEXITSTATUS(status);
+ else if (WIFSIGNALED(status))
+ e = WTERMSIG(status);
+ else /* can't happen */
+ e = 1;
done(e);
+ }
}
void
OpenPOWER on IntegriCloud