From: Ari Johnson Date: Tue, 4 Aug 2015 14:51:37 +0000 (-0400) Subject: info_slave returns better error explanations X-Git-Url: https://git.theari.com/?a=commitdiff_plain;h=7959c3e4f518f4e293c065527245126194b3221b;p=cobramush.git info_slave returns better error explanations --- 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); }