summaryrefslogtreecommitdiffstats
path: root/bin/dig/nslookup.c
diff options
context:
space:
mode:
authorerwin <erwin@FreeBSD.org>2012-12-05 12:53:50 +0000
committererwin <erwin@FreeBSD.org>2012-12-05 12:53:50 +0000
commitfd5e2d2ee32092bd75f13be0af0b4080836f3238 (patch)
treedfe0c09893b34b160ac11d74d2862e8f52ed43fe /bin/dig/nslookup.c
parent069326c8804fea8570cba6e7d30c4a56331a6b69 (diff)
downloadFreeBSD-src-fd5e2d2ee32092bd75f13be0af0b4080836f3238.zip
FreeBSD-src-fd5e2d2ee32092bd75f13be0af0b4080836f3238.tar.gz
Vendor import of Bind 9.8.4
Approved by: delphij (mentor) Sponsored by: DK Hostmaster A/S
Diffstat (limited to 'bin/dig/nslookup.c')
-rw-r--r--bin/dig/nslookup.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/bin/dig/nslookup.c b/bin/dig/nslookup.c
index 48c390b..2ef8f84 100644
--- a/bin/dig/nslookup.c
+++ b/bin/dig/nslookup.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004-2011 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2012 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -57,6 +57,7 @@ static isc_boolean_t in_use = ISC_FALSE;
static char defclass[MXRD] = "IN";
static char deftype[MXRD] = "A";
static isc_event_t *global_event = NULL;
+static int query_error = 1, print_error = 0;
static char domainopt[DNS_NAME_MAXTEXT];
@@ -406,6 +407,9 @@ isc_result_t
printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
char servtext[ISC_SOCKADDR_FORMATSIZE];
+ /* I've we've gotten this far, we've reached a server. */
+ query_error = 0;
+
debug("printmessage()");
isc_sockaddr_format(&query->sockaddr, servtext, sizeof(servtext));
@@ -433,6 +437,9 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
(msg->rcode != dns_rcode_nxdomain) ? nametext :
query->lookup->textname, rcode_totext(msg->rcode));
debug("returning with rcode == 0");
+
+ /* the lookup failed */
+ print_error |= 1;
return (ISC_R_SUCCESS);
}
@@ -887,5 +894,5 @@ main(int argc, char **argv) {
destroy_libs();
isc_app_finish();
- return (0);
+ return (query_error | print_error);
}
OpenPOWER on IntegriCloud