diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1998-01-17 23:13:35 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1998-01-17 23:13:35 +0000 |
commit | d22474f5df2457768f069df9d86d0a9bc52a170b (patch) | |
tree | 1acb78b0dea99f9c6e8c72d8c6c82c4b8b7519d5 /driver.c | |
parent | dda3f5aab91553690f6cede95e45327b4c03e0bb (diff) | |
download | fetchmail-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.c | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -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) { |