From bc08c526f2c9f1c077ae9975c2cd988e174c3fa3 Mon Sep 17 00:00:00 2001 From: Ari Johnson Date: Mon, 10 Aug 2015 10:39:31 -0400 Subject: [PATCH] Report info_slave errors to stderr and do not use them in place of data to MUSH --- src/info_slave.c | 47 ++++++++++++++++------------------------------- 1 file changed, 16 insertions(+), 31 deletions(-) diff --git a/src/info_slave.c b/src/info_slave.c index 4e1ed54..f0845b6 100644 --- a/src/info_slave.c +++ b/src/info_slave.c @@ -193,16 +193,11 @@ main(int argc, char *argv[]) bp = buf; if ((gairesult = getnameinfo(&remote.addr, rlen, host, sizeof host, NULL, 0, NI_NUMERICHOST | NI_NUMERICSERV)) != 0) { - safe_str("Error: getnameinfo(remote): ", buf, &bp); - if (gairesult == EAI_SYSTEM) { - safe_integer(errno, buf, &bp); - safe_chr('/', buf, &bp); - safe_str(strerror(errno), buf, &bp); - } else { - safe_integer(gairesult, buf, &bp); - safe_chr('/', buf, &bp); - safe_str(gai_strerror(gairesult), buf, &bp); - } + if (gairesult == EAI_SYSTEM) + perror("info_slave getnameinfo"); + else + fprintf(stderr, "info_slave getnameinfo: %s\n", + gai_strerror(gairesult)); } else { safe_str(host, buf, &bp); } @@ -210,16 +205,11 @@ main(int argc, char *argv[]) if ((gairesult = getnameinfo(&local.addr, llen, NULL, 0, lport, sizeof lport, NI_NUMERICHOST | NI_NUMERICSERV)) != 0) { - safe_str("Error: getnameinfo(local): ", buf, &bp); - if (gairesult == EAI_SYSTEM) { - safe_integer(errno, buf, &bp); - safe_chr('/', buf, &bp); - safe_str(strerror(errno), buf, &bp); - } else { - safe_integer(gairesult, buf, &bp); - safe_chr('/', buf, &bp); - safe_str(gai_strerror(gairesult), buf, &bp); - } + if (gairesult == EAI_SYSTEM) + perror("info_slave getnameinfo"); + else + fprintf(stderr, "info_slave getnameinfo: %s\n", + gai_strerror(gairesult)); } else { safe_str(lport, buf, &bp); } @@ -239,18 +229,13 @@ main(int argc, char *argv[]) if (use_dns) { if ((gairesult = getnameinfo(&remote.addr, rlen, host, sizeof host, NULL, 0, NI_NUMERICSERV) != 0)) { - safe_str("Error: getnameinfo(local/dns): ", buf, &bp); - if (gairesult == EAI_SYSTEM) { - safe_integer(errno, buf, &bp); - safe_chr('/', buf, &bp); - safe_str(strerror(errno), buf, &bp); - } else { - safe_integer(gairesult, buf, &bp); - safe_chr('/', buf, &bp); - safe_str(gai_strerror(gairesult), buf, &bp); - } + if (gairesult == EAI_SYSTEM) + perror("info_slave getnameinfo"); + else + fprintf(stderr, "info_slave getnameinfo: %s\n", + gai_strerror(gairesult)); } else { - safe_str(host, buf, &bp); + safe_str(host, buf, &bp); } } else safe_str(host, buf, &bp); -- 2.30.2