aboutsummaryrefslogtreecommitdiffstats
path: root/driver.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1996-12-07 01:04:27 +0000
committerEric S. Raymond <esr@thyrsus.com>1996-12-07 01:04:27 +0000
commit6a2845a13efa8e77d24df2347b0c2f381b344583 (patch)
tree68977a7330f54ca9da2091f87105298d10e99d03 /driver.c
parent835b4bdb57b474df81432696df9c416dee8205c0 (diff)
downloadfetchmail-6a2845a13efa8e77d24df2347b0c2f381b344583.tar.gz
fetchmail-6a2845a13efa8e77d24df2347b0c2f381b344583.tar.bz2
fetchmail-6a2845a13efa8e77d24df2347b0c2f381b344583.zip
Fix the SIGCLD snafu.
svn path=/trunk/; revision=613
Diffstat (limited to 'driver.c')
-rw-r--r--driver.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/driver.c b/driver.c
index a390bc29..40851052 100644
--- a/driver.c
+++ b/driver.c
@@ -296,6 +296,7 @@ struct query *ctl; /* query control record */
int n, oldlen, mboxfd;
int inheaders,lines,sizeticker;
FILE *sinkfp;
+ RETSIGTYPE (*sigchld)();
#ifdef HAVE_GETHOSTBYNAME
char rbuf[HOSTLEN + USERNAMELEN + 4];
#endif /* HAVE_GETHOSTBYNAME */
@@ -531,6 +532,8 @@ struct query *ctl; /* query control record */
fprintf(stderr, "fetchmail: MDA open failed\n");
return(PS_IOERR);
}
+
+ sigchld = signal(SIGCLD, SIG_DFL);
}
else
{
@@ -623,6 +626,11 @@ struct query *ctl; /* query control record */
free(headers);
headers = NULL;
perror("fetchmail: writing RFC822 headers");
+ if (ctl->mda[0])
+ {
+ closemailpipe(mboxfd);
+ signal(SIGCLD, sigchld);
+ }
return(PS_IOERR);
}
else if (outlevel == O_VERBOSE)
@@ -706,6 +714,11 @@ struct query *ctl; /* query control record */
if (n < 0)
{
perror("fetchmail: writing message text");
+ if (ctl->mda[0])
+ {
+ closemailpipe(mboxfd);
+ signal(SIGCLD, sigchld);
+ }
return(PS_IOERR);
}
else if (outlevel == O_VERBOSE)
@@ -717,8 +730,12 @@ struct query *ctl; /* query control record */
if (ctl->mda[0])
{
+ int rc;
+
/* close the delivery pipe, we'll reopen before next message */
- if (closemailpipe(mboxfd))
+ rc = closemailpipe(mboxfd);
+ signal(SIGCLD, sigchld);
+ if (rc)
return(PS_IOERR);
}
else if (sinkfp)