summaryrefslogtreecommitdiff
path: root/usr.bin/mail/popen.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-06-12 17:51:54 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-06-12 17:51:54 +0000
commit7a7f36bfa25dfe05f4e3efaa2cae3267993d48de (patch)
tree7ad2a9d3740dd68469c74664e76c510bb3bfa35c /usr.bin/mail/popen.c
parenta0ceaddf9d85bcb4241b5053b342cee85c041e77 (diff)
Don't call truncate() directly; have rm() do it if we get EPERM on unlink()
In popen.c, findchild() may return NULL so catch that case.
Diffstat (limited to 'usr.bin/mail/popen.c')
-rw-r--r--usr.bin/mail/popen.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.bin/mail/popen.c b/usr.bin/mail/popen.c
index 59074db2bf3..2292b7dc5ba 100644
--- a/usr.bin/mail/popen.c
+++ b/usr.bin/mail/popen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: popen.c,v 1.16 1998/05/04 05:37:52 millert Exp $ */
+/* $OpenBSD: popen.c,v 1.17 1998/06/12 17:51:53 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.16 1998/05/04 05:37:52 millert Exp $";
+static char rcsid[] = "$OpenBSD: popen.c,v 1.17 1998/06/12 17:51:53 millert Exp $";
#endif
#endif /* not lint */
@@ -388,6 +388,9 @@ wait_child(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);
@@ -410,6 +413,9 @@ free_child(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);