From 47b40b940159a43557286fdb5ab0db74d4dcc93e Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Wed, 21 Sep 2005 14:43:11 +0000 Subject: When getaddrinfo() fails resolving a service, log getaddrinfo() error. svn path=/trunk/; revision=4310 --- servport.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'servport.c') diff --git a/servport.c b/servport.c index 171eb53f..4d0fe510 100644 --- a/servport.c +++ b/servport.c @@ -23,7 +23,7 @@ #include int servport(const char *service) { - int port; + int port, e; unsigned long u; char *end; @@ -47,7 +47,10 @@ int servport(const char *service) { memset(&hints, 0, sizeof hints); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; - if (getaddrinfo(NULL, service, &hints, &res)) { + e = getaddrinfo(NULL, service, &hints, &res); + if (e) { + report(stderr, GT_("getaddrinfo(NULL, \"%s\") error: %s\n"), + service, gai_strerror(e)); goto err; } else { switch(res->ai_addr->sa_family) { -- cgit v1.2.3