aboutsummaryrefslogtreecommitdiffstats
path: root/driver.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1998-01-17 23:13:35 +0000
committerEric S. Raymond <esr@thyrsus.com>1998-01-17 23:13:35 +0000
commitd22474f5df2457768f069df9d86d0a9bc52a170b (patch)
tree1acb78b0dea99f9c6e8c72d8c6c82c4b8b7519d5 /driver.c
parentdda3f5aab91553690f6cede95e45327b4c03e0bb (diff)
downloadfetchmail-d22474f5df2457768f069df9d86d0a9bc52a170b.tar.gz
fetchmail-d22474f5df2457768f069df9d86d0a9bc52a170b.tar.bz2
fetchmail-d22474f5df2457768f069df9d86d0a9bc52a170b.zip
Make sure we don't pclose() a garbage output sink.
svn path=/trunk/; revision=1584
Diffstat (limited to 'driver.c')
-rw-r--r--driver.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/driver.c b/driver.c
index 66d4c619..af4956fc 100644
--- a/driver.c
+++ b/driver.c
@@ -1248,7 +1248,8 @@ int num; /* index of message */
error(0, errno, "writing RFC822 headers");
if (ctl->mda)
{
- pclose(sinkfp);
+ if (sinkfp)
+ pclose(sinkfp);
signal(SIGCHLD, sigchld);
}
return(PS_IOERR);
@@ -1342,7 +1343,8 @@ flag forward; /* TRUE to forward */
{
if (ctl->mda)
{
- pclose(sinkfp);
+ if (sinkfp)
+ pclose(sinkfp);
signal(SIGCHLD, sigchld);
}
return(PS_SOCKET);
@@ -1383,7 +1385,8 @@ flag forward; /* TRUE to forward */
error(0, errno, "writing message text");
if (ctl->mda)
{
- pclose(sinkfp);
+ if (sinkfp)
+ pclose(sinkfp);
signal(SIGCHLD, sigchld);
}
return(PS_IOERR);
@@ -1765,6 +1768,9 @@ const struct method *proto; /* protocol method table */
error_build(" ");
}
+ /* later we'll test for this before closing */
+ sinkfp = (FILE *)NULL;
+
/*
* Read the message headers and ship them to the
* output sink.
@@ -1875,7 +1881,10 @@ const struct method *proto; /* protocol method table */
int rc;
/* close the delivery pipe, we'll reopen before next message */
- rc = pclose(sinkfp);
+ if (sinkfp)
+ rc = pclose(sinkfp);
+ else
+ rc = 0;
signal(SIGCHLD, sigchld);
if (rc)
{