summaryrefslogtreecommitdiff
path: root/libexec/spamd-setup
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2004-02-26 08:18:57 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2004-02-26 08:18:57 +0000
commit7f28246c4f0d3653895dab150883eae74ff5b4b5 (patch)
tree5215693d78f2192a0f2afe13a78ed51a16ebbf6a /libexec/spamd-setup
parent3e2f267d7a634f03b8f16b9601f1d3042f227545 (diff)
paranoia; beck ok
Diffstat (limited to 'libexec/spamd-setup')
-rw-r--r--libexec/spamd-setup/spamd-setup.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/libexec/spamd-setup/spamd-setup.c b/libexec/spamd-setup/spamd-setup.c
index 924f869625e..3ead7eb5523 100644
--- a/libexec/spamd-setup/spamd-setup.c
+++ b/libexec/spamd-setup/spamd-setup.c
@@ -1,4 +1,5 @@
-/* $OpenBSD: spamd-setup.c,v 1.16 2004/01/21 08:07:41 deraadt Exp $ */
+/* $OpenBSD: spamd-setup.c,v 1.17 2004/02/26 08:18:56 deraadt Exp $ */
+
/*
* Copyright (c) 2003 Bob Beck. All rights reserved.
*
@@ -265,6 +266,8 @@ open_child(char *file, char **argv)
return(-1);
switch (pid = fork()) {
case -1:
+ close(pdes[0]);
+ close(pdes[1]);
return(-1);
case 0:
/* child */
@@ -276,6 +279,7 @@ open_child(char *file, char **argv)
execvp(file, argv);
_exit(1);
}
+
/* parent */
close(pdes[1]);
return(pdes[0]);
@@ -641,6 +645,8 @@ configure_pf(struct cidr **blacklists)
return(-1);
switch (pid = fork()) {
case -1:
+ close(pdes[0]);
+ close(pdes[1]);
return(-1);
case 0:
/* child */
@@ -652,11 +658,14 @@ configure_pf(struct cidr **blacklists)
execvp(PATH_PFCTL, argv);
_exit(1);
}
+
/* parent */
close(pdes[0]);
pf = fdopen(pdes[1], "w");
- if (pf == NULL)
+ if (pf == NULL) {
+ close(pdes[1]);
return(-1);
+ }
}
while (*blacklists != NULL) {
struct cidr *b = *blacklists;