[bind] nslookup: return non-zero exit code when fail to get answer (#816164)

Adam Tkac atkac at fedoraproject.org
Mon May 7 15:53:29 UTC 2012


commit 341c7de50d7729bee4ef8f0863bc43f4fb415396
Author: Adam Tkac <atkac at redhat.com>
Date:   Mon May 7 17:52:48 2012 +0200

    nslookup: return non-zero exit code when fail to get answer (#816164)
    
    Signed-off-by: Adam Tkac <atkac at redhat.com>

 bind.spec             |    7 ++++++-
 bind98-rh816164.patch |   41 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 1 deletions(-)
---
diff --git a/bind.spec b/bind.spec
index fd7661d..687e5f6 100644
--- a/bind.spec
+++ b/bind.spec
@@ -22,7 +22,7 @@ Summary:  The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) serv
 Name:     bind
 License:  ISC
 Version:  9.9.0
-Release:  5%{?dist}
+Release:  6%{?dist}
 Epoch:    32
 Url:      http://www.isc.org/products/BIND/
 Buildroot:%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -73,6 +73,7 @@ Patch124:nslookup-norec.patch
 Patch125:bind99-buildfix.patch
 Patch127:bind99-forward.patch
 Patch128:bind99-coverity.patch
+Patch129:bind98-rh816164.patch
 
 # SDB patches
 Patch11: bind-9.3.2b2-sdbsrc.patch
@@ -270,6 +271,7 @@ pushd bin/dig
 popd
 %patch125 -p1 -b .buildfix
 %patch127 -p1 -b .forward
+%patch129 -p1 -b .rh816164
 
 %if %{SDB}
 %patch101 -p1 -b .old-api
@@ -774,6 +776,9 @@ rm -rf ${RPM_BUILD_ROOT}
 %endif
 
 %changelog
+* Mon May 07 2012 Adam Tkac <atkac redhat com> 32:9.9.0-6
+- nslookup: return non-zero exit code when fail to get answer (#816164)
+
 * Thu Apr 26 2012 Adam Tkac <atkac redhat com> 32:9.9.0-5
 - initscript: don't umount /var/named when didn't mount it
 
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;
+ }


More information about the scm-commits mailing list