From f62f19c0dea13f846fd633393f8dd13c33f10061 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 14 May 1997 02:57:04 +0000 Subject: Be sure to write the headers properly. svn path=/trunk/; revision=994 --- driver.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'driver.c') 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; -- cgit v1.2.3