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

Signed-off-by: Adam Tkac <atkac@redhat.com>
This commit is contained in:
Adam Tkac 2012-05-07 17:52:48 +02:00
parent 773ac2b8b3
commit 341c7de50d
2 changed files with 47 additions and 1 deletions

View File

@ -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

41
bind98-rh816164.patch Normal file
View File

@ -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;
}