From e786ecbb883f833ecb17cf0a80dfe00da10cb3de Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Fri, 27 Oct 2006 18:04:22 +0000 Subject: [PATCH] When SMTP client can't connect and errno = 0, set the DSN to 'Unable to connect to...' instead of 'Success' --- citadel/serv_smtp.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/citadel/serv_smtp.c b/citadel/serv_smtp.c index ba8ae9959..54363c9e8 100644 --- a/citadel/serv_smtp.c +++ b/citadel/serv_smtp.c @@ -1079,13 +1079,20 @@ void smtp_try(const char *key, const char *addr, int *status, if (!mx_port[0]) { strcpy(mx_port, "25"); } - lprintf(CTDL_DEBUG, "FIXME user<%s> pass<%s> host<%s> port<%s>\n", - mx_user, mx_pass, mx_host, mx_port); + /* lprintf(CTDL_DEBUG, "FIXME user<%s> pass<%s> host<%s> port<%s>\n", + mx_user, mx_pass, mx_host, mx_port); */ lprintf(CTDL_DEBUG, "Trying %s : %s ...\n", mx_host, mx_port); sock = sock_connect(mx_host, mx_port, "tcp"); snprintf(dsn, SIZ, "Could not connect: %s", strerror(errno)); if (sock >= 0) lprintf(CTDL_DEBUG, "Connected!\n"); - if (sock < 0) snprintf(dsn, SIZ, "%s", strerror(errno)); + if (sock < 0) { + if (errno > 0) { + snprintf(dsn, SIZ, "%s", strerror(errno)); + } + else { + snprintf(dsn, SIZ, "Unable to connect to %s : %s\n", mx_host, mx_port); + } + } } if (sock < 0) { -- 2.39.2