aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;