aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rw-r--r--socket.c9
2 files changed, 8 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index 3b37047d..bcb00beb 100644
--- a/NEWS
+++ b/NEWS
@@ -97,7 +97,8 @@ fetchmail 6.3.5 (not yet released):
documented behavior. SIGUSR1 has always been a wakeup signal for both root
(undocumented) and non-root users. See also the deprecation warning above.
* When a connection fails, log not only the IP address, but also host and
- service name.
+ service name and the port number. Log the latter when trying to connect in
+ verbose mode, too.
* Keep syslog output at one line per message (this works if no errors occur).
# CHANGES:
diff --git a/socket.c b/socket.c
index 3cf84844..ee9600fd 100644
--- a/socket.c
+++ b/socket.c
@@ -287,15 +287,18 @@ int SockOpen(const char *host, const char *service,
i = -1;
for (ai = ai0; ai; ai = ai->ai_next) {
- char buf[80];
+ char buf[80],pb[80];
int gnie;
gnie = getnameinfo(ai->ai_addr, ai->ai_addrlen, buf, sizeof(buf), NULL, 0, NI_NUMERICHOST);
if (gnie)
snprintf(buf, sizeof(buf), GT_("unknown (%s)"), gai_strerror(gnie));
+ gnie = getnameinfo(ai->ai_addr, ai->ai_addrlen, NULL, 0, pb, sizeof(pb), NI_NUMERICSERV);
+ if (gnie)
+ snprintf(pb, sizeof(pb), GT_("unknown (%s)"), gai_strerror(gnie));
if (outlevel >= O_VERBOSE)
- report_build(stdout, GT_("Trying to connect to %s..."), buf);
+ report_build(stdout, GT_("Trying to connect to %s/%s..."), buf, pb);
i = socket(ai->ai_family, ai->ai_socktype, 0);
if (i < 0) {
/* mask EAFNOSUPPORT errors, they confuse users for
@@ -321,7 +324,7 @@ int SockOpen(const char *host, const char *service,
if (outlevel >= O_VERBOSE)
report_complete(stdout, GT_("connection failed.\n"));
if (outlevel > O_SILENT)
- report(stderr, GT_("connection to %s:%s [%s] failed: %s.\n"), host, service, buf, strerror(e));
+ report(stderr, GT_("connection to %s:%s [%s/%s] failed: %s.\n"), host, service, buf, pb, strerror(e));
fm_close(i);
i = -1;
continue;