=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mail/popen.c,v retrieving revision 1.19 retrieving revision 1.20 diff -c -r1.19 -r1.20 *** src/usr.bin/mail/popen.c 1998/08/15 23:17:24 1.19 --- src/usr.bin/mail/popen.c 1998/09/08 15:24:38 1.20 *************** *** 1,4 **** ! /* $OpenBSD: popen.c,v 1.19 1998/08/15 23:17:24 millert Exp $ */ /* $NetBSD: popen.c,v 1.6 1997/05/13 06:48:42 mikel Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: popen.c,v 1.20 1998/09/08 15:24:38 millert Exp $ */ /* $NetBSD: popen.c,v 1.6 1997/05/13 06:48:42 mikel Exp $ */ /* *************** *** 38,44 **** #if 0 static char sccsid[] = "@(#)popen.c 8.1 (Berkeley) 6/6/93"; #else ! static char rcsid[] = "$OpenBSD: popen.c,v 1.19 1998/08/15 23:17:24 millert Exp $"; #endif #endif /* not lint */ --- 38,44 ---- #if 0 static char sccsid[] = "@(#)popen.c 8.1 (Berkeley) 6/6/93"; #else ! static char rcsid[] = "$OpenBSD: popen.c,v 1.20 1998/09/08 15:24:38 millert Exp $"; #endif #endif /* not lint */ *************** *** 221,228 **** * Run a command without a shell, with optional arguments and splicing * of stdin and stdout. The command name can be a sequence of words. * Signals must be handled by the caller. ! * "Mask" contains the signals to ignore in the new process. ! * SIGINT is enabled unless it's in the mask. */ /*VARARGS4*/ int --- 221,228 ---- * Run a command without a shell, with optional arguments and splicing * of stdin and stdout. The command name can be a sequence of words. * Signals must be handled by the caller. ! * "nset" contains the signals to ignore in the new process. ! * SIGINT is enabled unless it's in "nset". */ /*VARARGS4*/ int *************** *** 381,396 **** wait_child(pid) int pid; { ! struct child *cp = findchild(pid, 0); sigset_t nset, oset; - if (cp == NULL) - return(-1); - sigemptyset(&nset); sigaddset(&nset, SIGCHLD); sigprocmask(SIG_BLOCK, &nset, &oset); while (!cp->done) sigsuspend(&oset); wait_status = cp->status; --- 381,396 ---- wait_child(pid) int pid; { ! struct child *cp; sigset_t nset, oset; sigemptyset(&nset); sigaddset(&nset, SIGCHLD); sigprocmask(SIG_BLOCK, &nset, &oset); + if ((cp = findchild(pid, 0)) == NULL) + return(-1); + while (!cp->done) sigsuspend(&oset); wait_status = cp->status; *************** *** 406,420 **** free_child(pid) int pid; { ! struct child *cp = findchild(pid, 0); sigset_t nset, oset; - if (cp == NULL) - return; - sigemptyset(&nset); sigaddset(&nset, SIGCHLD); sigprocmask(SIG_BLOCK, &nset, &oset); if (cp->done) delchild(cp); --- 406,420 ---- free_child(pid) int pid; { ! struct child *cp; sigset_t nset, oset; sigemptyset(&nset); sigaddset(&nset, SIGCHLD); sigprocmask(SIG_BLOCK, &nset, &oset); + + if ((cp = findchild(pid, 0)) == NULL) + return; if (cp->done) delchild(cp);