diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1997-08-31 14:32:15 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1997-08-31 14:32:15 +0000 |
commit | 43b423506d775bedaa8f3fee0deb9e4787510ef4 (patch) | |
tree | 1222b008feba9e09461f84a37d7573644853e670 /usr.bin/mail | |
parent | 553533fcc325d0e4950c35fae454f72edd6687c7 (diff) |
Kill union wait.
Diffstat (limited to 'usr.bin/mail')
-rw-r--r-- | usr.bin/mail/cmd2.c | 8 | ||||
-rw-r--r-- | usr.bin/mail/fio.c | 9 | ||||
-rw-r--r-- | usr.bin/mail/popen.c | 14 |
3 files changed, 16 insertions, 15 deletions
diff --git a/usr.bin/mail/cmd2.c b/usr.bin/mail/cmd2.c index e42db4c3dab..69ca0dbaf94 100644 --- a/usr.bin/mail/cmd2.c +++ b/usr.bin/mail/cmd2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd2.c,v 1.6 1997/07/30 07:19:29 millert Exp $ */ +/* $OpenBSD: cmd2.c,v 1.7 1997/08/31 14:32:13 millert Exp $ */ /* $NetBSD: cmd2.c,v 1.7 1997/05/17 19:55:10 pk Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)cmd2.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$OpenBSD: cmd2.c,v 1.6 1997/07/30 07:19:29 millert Exp $"; +static char rcsid[] = "$OpenBSD: cmd2.c,v 1.7 1997/08/31 14:32:13 millert Exp $"; #endif #endif /* not lint */ @@ -383,7 +383,7 @@ core(v) void *v; { int pid; - extern union wait wait_status; + extern int wait_status; switch (pid = vfork()) { case -1: @@ -396,7 +396,7 @@ core(v) fputs("Okie dokie", stdout); fflush(stdout); wait_child(pid); - if (wait_status.w_coredump) + if (WIFSIGNALED(wait_status) && WCOREDUMP(wait_status)) puts(" -- Core dumped."); else puts(" -- Can't dump core."); diff --git a/usr.bin/mail/fio.c b/usr.bin/mail/fio.c index 634e36f2958..7938749126b 100644 --- a/usr.bin/mail/fio.c +++ b/usr.bin/mail/fio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fio.c,v 1.11 1997/07/28 15:20:30 millert Exp $ */ +/* $OpenBSD: fio.c,v 1.12 1997/08/31 14:32:13 millert Exp $ */ /* $NetBSD: fio.c,v 1.8 1997/07/07 22:57:55 phil Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)fio.c 8.2 (Berkeley) 4/20/95"; #else -static char rcsid[] = "$OpenBSD: fio.c,v 1.11 1997/07/28 15:20:30 millert Exp $"; +static char rcsid[] = "$OpenBSD: fio.c,v 1.12 1997/08/31 14:32:13 millert Exp $"; #endif #endif /* not lint */ @@ -342,7 +342,7 @@ expand(name) register char *cp, *shell; int pivec[2]; struct stat sbuf; - extern union wait wait_status; + extern int wait_status; /* * The order of evaluation is "%" and "#" expand into constants. @@ -394,7 +394,8 @@ expand(name) (void)close(pivec[1]); l = read(pivec[0], xname, PATHSIZE); (void)close(pivec[0]); - if (wait_child(pid) < 0 && wait_status.w_termsig != SIGPIPE) { + if (wait_child(pid) < 0 && WIFSIGNALED(wait_status) && + WTERMSIG(wait_status) != SIGPIPE) { fprintf(stderr, "\"%s\": Expansion failed.\n", name); return(NULL); } diff --git a/usr.bin/mail/popen.c b/usr.bin/mail/popen.c index e992c40e979..07f6ecfac82 100644 --- a/usr.bin/mail/popen.c +++ b/usr.bin/mail/popen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: popen.c,v 1.12 1997/08/05 04:00:00 deraadt Exp $ */ +/* $OpenBSD: popen.c,v 1.13 1997/08/31 14:32:14 millert Exp $ */ /* $NetBSD: popen.c,v 1.6 1997/05/13 06:48:42 mikel Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)popen.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$OpenBSD: popen.c,v 1.12 1997/08/05 04:00:00 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: popen.c,v 1.13 1997/08/31 14:32:14 millert Exp $"; #endif #endif /* not lint */ @@ -63,7 +63,7 @@ struct child { int pid; char done; char free; - union wait status; + int status; struct child *link; }; static struct child *child; @@ -345,12 +345,12 @@ sigchild(signo) int signo; { int pid; - union wait status; + int status; register struct child *cp; int save_errno = errno; while ((pid = - wait3((int *)&status, WNOHANG, (struct rusage *)0)) > 0) { + waitpid((pid_t)-1, &status, WNOHANG)) > 0) { cp = findchild(pid); if (cp->free) delchild(cp); @@ -362,7 +362,7 @@ sigchild(signo) errno = save_errno; } -union wait wait_status; +int wait_status; /* * Wait for a specific child to die. @@ -383,7 +383,7 @@ wait_child(pid) wait_status = cp->status; delchild(cp); sigprocmask(SIG_SETMASK, &oset, NULL); - return(wait_status.w_status ? -1 : 0); + return((WIFEXITED(wait_status) && WEXITSTATUS(wait_status)) ? -1 : 0); } /* |