From: Art Cancro Date: Fri, 27 Oct 2006 18:04:22 +0000 (+0000) Subject: When SMTP client can't connect and errno = 0, set X-Git-Tag: v7.86~3878 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=e786ecbb883f833ecb17cf0a80dfe00da10cb3de;p=citadel.git When SMTP client can't connect and errno = 0, set the DSN to 'Unable to connect to...' instead of 'Success' --- 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) {