summaryrefslogtreecommitdiffstats
path: root/bind98-rh816164.patch
diff options
context:
space:
mode:
authorAdam Tkac <atkac@redhat.com>2012-05-07 17:52:48 +0200
committerAdam Tkac <atkac@redhat.com>2012-05-07 17:52:48 +0200
commit341c7de50d7729bee4ef8f0863bc43f4fb415396 (patch)
tree4b632dd6da125105bc235d5d9712abce52f566e0 /bind98-rh816164.patch
parent773ac2b8b36f1011207d5de13b5c5b1ccea98686 (diff)
downloadbind-341c7de50d7729bee4ef8f0863bc43f4fb415396.tar.gz
bind-341c7de50d7729bee4ef8f0863bc43f4fb415396.tar.xz
bind-341c7de50d7729bee4ef8f0863bc43f4fb415396.zip
nslookup: return non-zero exit code when fail to get answer (#816164)
Signed-off-by: Adam Tkac <atkac@redhat.com>
Diffstat (limited to 'bind98-rh816164.patch')
-rw-r--r--bind98-rh816164.patch41
1 files changed, 41 insertions, 0 deletions
diff --git a/bind98-rh816164.patch b/bind98-rh816164.patch
new file mode 100644
index 0000000..c9dc541
--- /dev/null
+++ b/bind98-rh816164.patch
@@ -0,0 +1,41 @@
+diff -up bind-9.8.2rc1/bin/dig/nslookup.c.rh816164 bind-9.8.2rc1/bin/dig/nslookup.c
+--- bind-9.8.2rc1/bin/dig/nslookup.c.rh816164 2012-05-07 17:01:49.054026716 +0200
++++ bind-9.8.2rc1/bin/dig/nslookup.c 2012-05-07 17:15:42.516105665 +0200
+@@ -56,6 +56,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 seen_error = -1;
+
+ static char domainopt[DNS_NAME_MAXTEXT];
+
+@@ -404,6 +405,14 @@ trying(char *frm, dig_lookup_t *lookup)
+ isc_result_t
+ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
+ char servtext[ISC_SOCKADDR_FORMATSIZE];
++ int force_error;
++
++ /*
++ * We get called multiple times.
++ * Preserve any existing error status.
++ */
++ force_error = (seen_error == 1) ? 1 : 0;
++ seen_error = 1;
+
+ debug("printmessage()");
+
+@@ -451,6 +460,7 @@ printmessage(dig_query_t *query, dns_mes
+ printsection(query, msg, headers,
+ DNS_SECTION_ADDITIONAL);
+ }
++ seen_error = force_error;
+ return (ISC_R_SUCCESS);
+ }
+
+@@ -888,5 +898,5 @@ main(int argc, char **argv) {
+ destroy_libs();
+ isc_app_finish();
+
+- return (0);
++ return (seen_error == 0) ? 0 : 1;
+ }