diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1997-05-14 02:57:04 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1997-05-14 02:57:04 +0000 |
commit | f62f19c0dea13f846fd633393f8dd13c33f10061 (patch) | |
tree | 2920466f93a7fe302cd6ebcb74cbcbddc7c02a33 | |
parent | 610d851200f4621e9936d22f87335b956658718a (diff) | |
download | fetchmail-f62f19c0dea13f846fd633393f8dd13c33f10061.tar.gz fetchmail-f62f19c0dea13f846fd633393f8dd13c33f10061.tar.bz2 fetchmail-f62f19c0dea13f846fd633393f8dd13c33f10061.zip |
Be sure to write the headers properly.
svn path=/trunk/; revision=994
-rw-r--r-- | driver.c | 32 |
1 files changed, 15 insertions, 17 deletions
@@ -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; |