aboutsummaryrefslogtreecommitdiffstats
path: root/sink.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2002-10-31 13:38:29 +0000
committerEric S. Raymond <esr@thyrsus.com>2002-10-31 13:38:29 +0000
commitcaef674e29106c14aae5e77d82e6c3ab052d3d3b (patch)
tree73417ae78d8a4ac3930b163820d4f243596bf202 /sink.c
parent8cf3fdbd139435d0696e7c16f967bbeb1ab4d701 (diff)
downloadfetchmail-caef674e29106c14aae5e77d82e6c3ab052d3d3b.tar.gz
fetchmail-caef674e29106c14aae5e77d82e6c3ab052d3d3b.tar.bz2
fetchmail-caef674e29106c14aae5e77d82e6c3ab052d3d3b.zip
Sunil Shetye's minor fixes.
svn path=/trunk/; revision=3762
Diffstat (limited to 'sink.c')
-rw-r--r--sink.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sink.c b/sink.c
index 5ac588cb..5f484b17 100644
--- a/sink.c
+++ b/sink.c
@@ -263,6 +263,7 @@ static int send_bouncemail(struct query *ctl, struct msgblk *msg,
char daemon_name[18 + HOSTLEN] = "FETCHMAIL-DAEMON@";
char boundary[BUFSIZ], *bounce_to;
int sock;
+ static char *fqdn_of_host = NULL;
/* don't bounce in reply to undeliverable bounces */
if (!msg->return_path[0] || strcmp(msg->return_path, "<>") == 0)
@@ -273,7 +274,9 @@ static int send_bouncemail(struct query *ctl, struct msgblk *msg,
SMTP_setmode(SMTP_MODE);
/* can't just use fetchmailhost here, it might be localhost */
- strcat(daemon_name, host_fqdn());
+ if (fqdn_of_host == NULL)
+ fqdn_of_host = host_fqdn();
+ strcat(daemon_name, fqdn_of_host);
/* we need only SMTP for this purpose */
if ((sock = SockOpen("localhost", SMTP_PORT, NULL, NULL)) == -1)
@@ -584,7 +587,7 @@ int stuffline(struct query *ctl, char *buf)
/* The line may contain NUL characters. Find the last char to use
* -- the real line termination is the sequence "\n\0".
*/
- last = buf;
+ last = buf + 1; /* last[-1] must be valid! */
while ((last += strlen(last)) && (last[-1] != '\n'))
last++;