aboutsummaryrefslogtreecommitdiffstats
path: root/driver.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1997-05-14 02:57:04 +0000
committerEric S. Raymond <esr@thyrsus.com>1997-05-14 02:57:04 +0000
commitf62f19c0dea13f846fd633393f8dd13c33f10061 (patch)
tree2920466f93a7fe302cd6ebcb74cbcbddc7c02a33 /driver.c
parent610d851200f4621e9936d22f87335b956658718a (diff)
downloadfetchmail-f62f19c0dea13f846fd633393f8dd13c33f10061.tar.gz
fetchmail-f62f19c0dea13f846fd633393f8dd13c33f10061.tar.bz2
fetchmail-f62f19c0dea13f846fd633393f8dd13c33f10061.zip
Be sure to write the headers properly.
svn path=/trunk/; revision=994
Diffstat (limited to 'driver.c')
-rw-r--r--driver.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/driver.c b/driver.c
index 4dfa43fd..2f0accb6 100644
--- a/driver.c
+++ b/driver.c
@@ -891,28 +891,26 @@ char *realname; /* real name of host */
}
/* write all the headers */
- if (sinkfp)
+ n = 0;
+ if (ctl->mda && sinkfp)
+ n = fwrite(headers, 1, strlen(headers), sinkfp);
+ else if (ctl->smtp_socket != -1)
+ n = SockWrite(ctl->smtp_socket, headers, strlen(headers));
+
+ if (n < 0)
{
+ free(headers);
+ headers = NULL;
+ error(0, errno, "writing RFC822 headers");
if (ctl->mda)
- n = fwrite(headers, 1, strlen(headers), sinkfp);
- else
- n = SockWrite(ctl->smtp_socket, headers, strlen(headers));
-
- if (n < 0)
{
- free(headers);
- headers = NULL;
- error(0, errno, "writing RFC822 headers");
- if (ctl->mda)
- {
- pclose(sinkfp);
- signal(SIGCHLD, sigchld);
- }
- return(PS_IOERR);
+ pclose(sinkfp);
+ signal(SIGCHLD, sigchld);
}
- else if (outlevel == O_VERBOSE)
- fputs("#", stderr);
+ return(PS_IOERR);
}
+ else if (outlevel == O_VERBOSE)
+ fputs("#", stderr);
free(headers);
headers = NULL;