From 7959c3e4f518f4e293c065527245126194b3221b Mon Sep 17 00:00:00 2001 From: Ari Johnson Date: Tue, 4 Aug 2015 10:51:37 -0400 Subject: [PATCH] info_slave returns better error explanations --- src/info_slave.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/info_slave.c b/src/info_slave.c index 6b82690..84f4486 100644 --- a/src/info_slave.c +++ b/src/info_slave.c @@ -34,6 +34,7 @@ #include #endif #include +#include #include "conf.h" #include "externs.h" @@ -182,16 +183,20 @@ main(int argc, char *argv[]) bp = buf; if (getnameinfo(&remote.addr, rlen, host, sizeof host, NULL, 0, - NI_NUMERICHOST | NI_NUMERICSERV) != 0) - safe_str("An error occured", buf, &bp); - else + NI_NUMERICHOST | NI_NUMERICSERV) != 0) { + safe_str("Error: getnameinfo(remote): ", buf, &bp); + safe_str(strerror(errno), buf, &bp); + } else { safe_str(host, buf, &bp); + } safe_chr('^', buf, &bp); if (getnameinfo(&local.addr, llen, NULL, 0, lport, sizeof lport, - NI_NUMERICHOST | NI_NUMERICSERV) != 0) - safe_str("An error occured", buf, &bp); - else + NI_NUMERICHOST | NI_NUMERICSERV) != 0) { + safe_str("Error: getnameinfo(local): ", buf, &bp); + safe_str(strerror(errno), buf, &bp); + } else { safe_str(lport, buf, &bp); + } safe_chr('^', buf, &bp); if (use_ident > 0) { @@ -208,7 +213,8 @@ main(int argc, char *argv[]) if (use_dns) { if (getnameinfo(&remote.addr, rlen, host, sizeof host, NULL, 0, NI_NUMERICSERV) != 0) { - safe_str("An error occured", buf, &bp); + safe_str("Error: getnameinfo(local/dns): ", buf, &bp); + safe_str(strerror(errno), buf, &bp); } else { safe_str(host, buf, &bp); } -- 2.30.2