From f840a7320cb3a4cfdc1082756e842fcb3b350f75 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Fri, 5 Sep 1997 15:01:10 +0000 Subject: Avoid yet another core dump. svn path=/trunk/; revision=1305 --- driver.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/driver.c b/driver.c index 722f76e9..d6ea0a9e 100644 --- a/driver.c +++ b/driver.c @@ -866,7 +866,7 @@ int num; /* index of message */ } else { - char *ap, *ctt, options[MSGBUFSIZE], addr[128]; + char *ap, *ctt, options[MSGBUFSIZE], addr[128], *desthost; /* build a connection to the SMTP listener */ if ((smtp_open(ctl) == -1)) @@ -991,13 +991,14 @@ int num; /* index of message */ * or MX but not a CNAME. Some listeners (like exim) * enforce this. */ + desthost = ctl->smtphost ? ctl->smtphost : "localhost"; for (idp = xmit_names; idp; idp = idp->next) if (idp->val.num == XMIT_ACCEPT) { #ifdef HAVE_SNPRINTF - snprintf(addr, sizeof(addr)-1, "%s@%s", idp->id,ctl->smtphost); + snprintf(addr, sizeof(addr)-1, "%s@%s", idp->id, desthost); #else - sprintf(addr, "%s@%s", idp->id, ctl->smtphost); + sprintf(addr, "%s@%s", idp->id, desthost); #endif /* HAVE_SNPRINTF */ if (SMTP_rcpt(ctl->smtp_socket, addr) == SM_OK) @@ -1013,9 +1014,9 @@ int num; /* index of message */ if (!good_addresses) { #ifdef HAVE_SNPRINTF - snprintf(addr, sizeof(addr)-1, "%s@%s", idp->id, ctl->smtphost); + snprintf(addr, sizeof(addr)-1, "%s@%s", idp->id, desthost); #else - sprintf(addr, "%s@%s", idp->id, ctl->smtphost); + sprintf(addr, "%s@%s", idp->id, desthost); #endif /* HAVE_SNPRINTF */ if (SMTP_rcpt(ctl->smtp_socket, user) != SM_OK) -- cgit v1.2.3