diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2019-01-09 13:38:57 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2019-01-09 13:38:57 +0100 |
commit | 6ca8e347fed8c24655df692f22694baf7c572770 (patch) | |
tree | 5ec15986d0e68b418f3475176af642e57b6b2c8b /networking | |
parent | 841912311252c861d34f5356cb32acc95f008b0f (diff) | |
download | busybox-6ca8e347fed8c24655df692f22694baf7c572770.tar.gz |
nslookup: return exitcode 1 on resolution errors
function old new delta
nslookup_main 757 760 +3
send_queries 1690 1677 -13
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking')
-rw-r--r-- | networking/nslookup.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/networking/nslookup.c b/networking/nslookup.c index cd3c00003..24e09d4f0 100644 --- a/networking/nslookup.c +++ b/networking/nslookup.c @@ -257,7 +257,7 @@ int nslookup_main(int argc, char **argv) struct ns { const char *name; len_and_sockaddr *lsa; - int failures; + //UNUSED: int failures; int replies; }; @@ -320,6 +320,7 @@ struct globals { struct query *query; char *search; smalluint have_search_directive; + smalluint exitcode; } FIX_ALIASING; #define G (*(struct globals*)bb_common_bufsiz1) #define INIT_G() do { \ @@ -593,7 +594,7 @@ static int send_queries(struct ns *ns) /* Retry immediately on SERVFAIL */ if (rcode == 2) { - ns->failures++; + //UNUSED: ns->failures++; if (servfail_retry) { servfail_retry--; write(pfd.fd, G.query[qn].query, G.query[qn].qlen); @@ -612,9 +613,12 @@ static int send_queries(struct ns *ns) if (rcode != 0) { printf("** server can't find %s: %s\n", G.query[qn].name, rcodes[rcode]); + G.exitcode = EXIT_FAILURE; } else { - if (parse_reply(reply, recvlen) < 0) + if (parse_reply(reply, recvlen) < 0) { printf("*** Can't find %s: Parse error\n", G.query[qn].name); + G.exitcode = EXIT_FAILURE; + } } bb_putchar('\n'); n_replies++; @@ -988,7 +992,7 @@ int nslookup_main(int argc UNUSED_PARAM, char **argv) free(G.query); } - return EXIT_SUCCESS; + return G.exitcode; } #endif |