This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.25-651-gb606c6c


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  b606c6ce66d4772068bfe3e410c28a247633ee24 (commit)
       via  3f8f1eb6b0ca45205cea3591f27727e21d598f62 (commit)
       via  6da48ca0b2cf328d9ef43c510e74a858c77a1e96 (commit)
       via  037751179905c7d6d624f287029237565465fa9a (commit)
       via  ded603542a8af41dc0c45af883d52390683f63aa (commit)
       via  6781d8e693eb9e1251875222db5c9885d7ebb596 (commit)
       via  d85f99679d89fb47426301620b7a980388fddcfd (commit)
       via  4d4ce84924dbde90294522598212e997b5f719e9 (commit)
       via  09fbb56ad69b9e02fb3710a9234566536a96facf (commit)
       via  5ca4aaea1840b3005c2de4cc73269a55e34ae2c3 (commit)
       via  74084febc4b668ca2258d88cade6fa5e28364ac6 (commit)
       via  7ab27b76d2d47942bc2ed74f674b62c3a51994bb (commit)
       via  5f17245d3e30ce9510a4061cf2a277cd8f6a815f (commit)
      from  5b757a51b514ea163bbec0a53dbbc06bb1b29241 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=b606c6ce66d4772068bfe3e410c28a247633ee24

commit b606c6ce66d4772068bfe3e410c28a247633ee24
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Jun 30 11:32:19 2017 +0200

    resolv: Remove source argument fron res_options

diff --git a/ChangeLog b/ChangeLog
index 6e8e456..ec7ce1c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2017-06-30  Florian Weimer  <fweimer@redhat.com>
 
+	* resolv/res_init.c (res_setoptions): Remove source argument.
+	(res_vinit_1): Adjust.
+
+2017-06-30  Florian Weimer  <fweimer@redhat.com>
+
 	* resolv/res_query.c (DEBUG): Remove preprocessor conditional.
 
 2017-06-30  Florian Weimer  <fweimer@redhat.com>
diff --git a/resolv/res_init.c b/resolv/res_init.c
index 821f060..5d8b2c9 100644
--- a/resolv/res_init.c
+++ b/resolv/res_init.c
@@ -103,7 +103,7 @@
 #include <inet/net-internal.h>
 #include <errno.h>
 
-static void res_setoptions (res_state, const char *, const char *);
+static void res_setoptions (res_state, const char *);
 static uint32_t net_mask (struct in_addr);
 
 unsigned long long int __res_initstamp;
@@ -381,7 +381,7 @@ res_vinit_1 (res_state statp, bool preinit, FILE *fp, char **buffer)
             }
           if (MATCH (*buffer, "options"))
             {
-              res_setoptions (statp, *buffer + sizeof ("options") - 1, "conf");
+              res_setoptions (statp, *buffer + sizeof ("options") - 1);
               continue;
             }
         }
@@ -417,7 +417,7 @@ res_vinit_1 (res_state statp, bool preinit, FILE *fp, char **buffer)
     }
 
   if ((cp = getenv ("RES_OPTIONS")) != NULL)
-    res_setoptions (statp, cp, "env");
+    res_setoptions (statp, cp);
   statp->options |= RES_INIT;
   return true;
 }
@@ -469,7 +469,7 @@ __res_vinit (res_state statp, int preinit)
 }
 
 static void
-res_setoptions (res_state statp, const char *options, const char *source)
+res_setoptions (res_state statp, const char *options)
 {
   const char *cp = options;
 

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=3f8f1eb6b0ca45205cea3591f27727e21d598f62

commit 3f8f1eb6b0ca45205cea3591f27727e21d598f62
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Jun 30 11:32:12 2017 +0200

    resolv: Remove DEBUG from resolv/res_query.c

diff --git a/ChangeLog b/ChangeLog
index aa6b71a..6e8e456 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2017-06-30  Florian Weimer  <fweimer@redhat.com>
 
+	* resolv/res_query.c (DEBUG): Remove preprocessor conditional.
+
+2017-06-30  Florian Weimer  <fweimer@redhat.com>
+
 	* resolv/res_data.c: Reformat to GNU style.
 	(res_close): Update comments.
 
diff --git a/resolv/res_query.c b/resolv/res_query.c
index 5312c8e..760bf32 100644
--- a/resolv/res_query.c
+++ b/resolv/res_query.c
@@ -80,9 +80,6 @@
 #include <string.h>
 #include <shlib-compat.h>
 
-/* Options.  Leave them on. */
-/* #undef DEBUG */
-
 #if PACKETSZ > 65536
 #define MAXPACKET	PACKETSZ
 #else
@@ -133,11 +130,6 @@ __libc_res_nquery(res_state statp,
  again:
 	hp->rcode = NOERROR;	/* default */
 
-#ifdef DEBUG
-	if (statp->options & RES_DEBUG)
-		printf(";; res_query(%s, %d, %d)\n", name, class, type);
-#endif
-
 	if (type == T_QUERY_A_AND_AAAA)
 	  {
 	    n = res_nmkquery(statp, QUERY, name, class, T_A, NULL, 0, NULL,
@@ -211,10 +203,6 @@ __libc_res_nquery(res_state statp,
 		}
 	}
 	if (__glibc_unlikely (n <= 0))       {
-#ifdef DEBUG
-		if (statp->options & RES_DEBUG)
-			printf(";; res_query: mkquery failed\n");
-#endif
 		RES_SET_H_ERRNO(statp, NO_RECOVERY);
 		if (use_malloc)
 			free (buf);
@@ -227,10 +215,6 @@ __libc_res_nquery(res_state statp,
 	if (use_malloc)
 		free (buf);
 	if (n < 0) {
-#ifdef DEBUG
-		if (statp->options & RES_DEBUG)
-			printf(";; res_query: send error\n");
-#endif
 		RES_SET_H_ERRNO(statp, TRY_AGAIN);
 		return (n);
 	}
@@ -260,15 +244,6 @@ __libc_res_nquery(res_state statp,
 
 	if ((hp->rcode != NOERROR || ntohs(hp->ancount) == 0)
 	    && (hp2->rcode != NOERROR || ntohs(hp2->ancount) == 0)) {
-#ifdef DEBUG
-		if (statp->options & RES_DEBUG) {
-			printf(";; rcode = %d, ancount=%d\n", hp->rcode,
-			    ntohs(hp->ancount));
-			if (hp != hp2)
-			  printf(";; rcode2 = %d, ancount2=%d\n", hp2->rcode,
-				 ntohs(hp2->ancount));
-		}
-#endif
 		switch (hp->rcode == NOERROR ? hp2->rcode : hp->rcode) {
 		case NXDOMAIN:
 			if ((hp->rcode == NOERROR && ntohs (hp->ancount) != 0)
@@ -374,12 +349,6 @@ __libc_res_nsearch(res_state statp,
 					  anslen, answerp, answerp2,
 					  nanswerp2, resplen2, answerp2_malloced));
 
-#ifdef DEBUG
-	if (statp->options & RES_DEBUG)
-		printf("dots=%d, statp->ndots=%d, trailing_dot=%d, name=%s\n",
-		       (int)dots,(int)statp->ndots,(int)trailing_dot,name);
-#endif
-
 	/*
 	 * If there are enough dots in the name, let's just give it a
 	 * try 'as is'. The threshold can be set with the "ndots" option.
@@ -590,11 +559,6 @@ __libc_res_nquerydomain(res_state statp,
 	const char *longname = nbuf;
 	size_t n, d;
 
-#ifdef DEBUG
-	if (statp->options & RES_DEBUG)
-		printf(";; res_nquerydomain(%s, %s, %d, %d)\n",
-		       name, domain?domain:"<Nil>", class, type);
-#endif
 	if (domain == NULL) {
 		n = strlen(name);
 

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=6da48ca0b2cf328d9ef43c510e74a858c77a1e96

commit 6da48ca0b2cf328d9ef43c510e74a858c77a1e96
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Jun 30 11:32:04 2017 +0200

    resolv: Reformat resolv/res_data.c to GNU style

diff --git a/ChangeLog b/ChangeLog
index 28cffb9..aa6b71a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2017-06-30  Florian Weimer  <fweimer@redhat.com>
 
+	* resolv/res_data.c: Reformat to GNU style.
+	(res_close): Update comments.
+
+2017-06-30  Florian Weimer  <fweimer@redhat.com>
+
 	* resolv/res_data.c (res_query, res_search, res_querydomain)
 	(hostalias): Move to ...
 	* resolv/res_Send.c (res_query, res_search, res_querydomain)
diff --git a/resolv/res_data.c b/resolv/res_data.c
index 5e7688c..2cafd38 100644
--- a/resolv/res_data.c
+++ b/resolv/res_data.c
@@ -1,3 +1,21 @@
+/* Miscellaneous definitions for libresolv.
+   Copyright (C) 1995-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
 /*
  * Copyright (c) 1995-1999 by Internet Software Consortium.
  *
@@ -17,18 +35,20 @@
 
 #include <resolv.h>
 
+/* This function belongs to libresolv, which is why it is not included
+   in res-close.c.  */
 void
-res_close(void) {
-	/*
-	 * Some stupid programs out there call res_close() before res_init().
-	 * Since _res._vcsock isn't explicitly initialized, these means that
-	 * we could do a close(0), which might lead to some security problems.
-	 * Therefore we check if res_init() was called before by looking at
-	 * the RES_INIT bit in _res.options.  If it hasn't been set we bail out
-	 * early.  */
-	if ((_res.options & RES_INIT) == 0)
-	  return;
-	/* We don't free the name server addresses because we never
-	   did it and it would be done implicitly on shutdown.  */
-	__res_iclose(&_res, false);
+__res_close (void)
+{
+  /* Some programs call res_close before res_init.  Since _res._vcsock
+     isn't explicitly initialized, these means that we could call
+     close (0), which might lead to some security problems.  Therefore
+     we check if res_init was called before by looking at the RES_INIT
+     bit in _res.options.  If it hasn't been set we bail out
+     early.  */
+  if ((_res.options & RES_INIT) == 0)
+    return;
+  /* We don't free the name server addresses because we never did it
+     and it would be done implicitly on shutdown.  */
+  __res_iclose (&_res, false);
 }

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=037751179905c7d6d624f287029237565465fa9a

commit 037751179905c7d6d624f287029237565465fa9a
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Jun 30 11:31:54 2017 +0200

    resolv: Move res_query, res_search res_querydomain, hostalias
    
    From res_data.c to query.c

diff --git a/ChangeLog b/ChangeLog
index 5b5b0d1..28cffb9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2017-06-30  Florian Weimer  <fweimer@redhat.com>
 
+	* resolv/res_data.c (res_query, res_search, res_querydomain)
+	(hostalias): Move to ...
+	* resolv/res_Send.c (res_query, res_search, res_querydomain)
+	(hostalias): here.
+
+2017-06-30  Florian Weimer  <fweimer@redhat.com>
+
 	* resolv/res_data.c (res_isourserver, res_send): Move to ...
 	* resolv/res_send.c (res_isourserver, res_send): here.
 
diff --git a/resolv/res_data.c b/resolv/res_data.c
index b790b4b..5e7688c 100644
--- a/resolv/res_data.c
+++ b/resolv/res_data.c
@@ -15,35 +15,7 @@
  * SOFTWARE.
  */
 
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <arpa/nameser.h>
-
-#include <ctype.h>
-#include <netdb.h>
 #include <resolv.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-int
-res_query(const char *name,	/* domain name */
-	  int class, int type,	/* class and type of query */
-	  u_char *answer,	/* buffer to put answer */
-	  int anslen)		/* size of answer buffer */
-{
-	if (__res_maybe_init (&_res, 1) == -1) {
-		RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
-		return (-1);
-	}
-	return (res_nquery(&_res, name, class, type, answer, anslen));
-}
 
 void
 res_close(void) {
@@ -60,55 +32,3 @@ res_close(void) {
 	   did it and it would be done implicitly on shutdown.  */
 	__res_iclose(&_res, false);
 }
-
-int
-res_search(const char *name,	/* domain name */
-	   int class, int type,	/* class and type of query */
-	   u_char *answer,	/* buffer to put answer */
-	   int anslen)		/* size of answer */
-{
-	if (__res_maybe_init (&_res, 1) == -1) {
-		RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
-		return (-1);
-	}
-
-	return (res_nsearch(&_res, name, class, type, answer, anslen));
-}
-
-int
-res_querydomain(const char *name,
-		const char *domain,
-		int class, int type,	/* class and type of query */
-		u_char *answer,		/* buffer to put answer */
-		int anslen)		/* size of answer */
-{
-	if (__res_maybe_init (&_res, 1) == -1) {
-		RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
-		return (-1);
-	}
-
-	return (res_nquerydomain(&_res, name, domain,
-				 class, type,
-				 answer, anslen));
-}
-
-const char *
-hostalias(const char *name) {
-	static char abuf[MAXDNAME];
-
-	return (res_hostalias(&_res, name, abuf, sizeof abuf));
-}
-libresolv_hidden_def (hostalias)
-
-
-
-#include <shlib-compat.h>
-
-#if SHLIB_COMPAT(libresolv, GLIBC_2_0, GLIBC_2_2)
-# undef res_query
-# undef res_querydomain
-# undef res_search
-weak_alias (__res_query, res_query);
-weak_alias (__res_querydomain, res_querydomain);
-weak_alias (__res_search, res_search);
-#endif
diff --git a/resolv/res_query.c b/resolv/res_query.c
index 0ca3a65..5312c8e 100644
--- a/resolv/res_query.c
+++ b/resolv/res_query.c
@@ -78,7 +78,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <resolv/resolv-internal.h>
+#include <shlib-compat.h>
 
 /* Options.  Leave them on. */
 /* #undef DEBUG */
@@ -319,6 +319,18 @@ res_nquery(res_state statp,
 }
 libresolv_hidden_def (res_nquery)
 
+int
+res_query (const char *name, int class, int type,
+	   unsigned char *answer, int anslen)
+{
+  if (__res_maybe_init (&_res, 1) == -1)
+    {
+      RES_SET_H_ERRNO (&_res, NETDB_INTERNAL);
+      return -1;
+    }
+  return res_nquery (&_res, name, class, type, answer, anslen);
+}
+
 /*
  * Formulate a normal query, send, and retrieve answer in supplied buffer.
  * Return the size of the response on success, -1 on error.
@@ -545,6 +557,19 @@ res_nsearch(res_state statp,
 }
 libresolv_hidden_def (res_nsearch)
 
+int
+res_search (const char *name, int class, int type,
+	    unsigned char *answer, int anslen)
+{
+  if (__res_maybe_init (&_res, 1) == -1)
+    {
+      RES_SET_H_ERRNO (&_res, NETDB_INTERNAL);
+      return -1;
+    }
+
+  return res_nsearch (&_res, name, class, type, answer, anslen);
+}
+
 /*
  * Perform a call on res_query on the concatenation of name and domain.
  */
@@ -610,6 +635,19 @@ res_nquerydomain(res_state statp,
 }
 libresolv_hidden_def (res_nquerydomain)
 
+int
+res_querydomain (const char *name, const char *domain, int class, int type,
+		 unsigned char *answer, int anslen)
+{
+  if (__res_maybe_init (&_res, 1) == -1)
+    {
+      RES_SET_H_ERRNO (&_res, NETDB_INTERNAL);
+      return -1;
+    }
+
+  return res_nquerydomain (&_res, name, domain, class, type, answer, anslen);
+}
+
 const char *
 res_hostalias(const res_state statp, const char *name, char *dst, size_t siz) {
 	char *file, *cp1, *cp2;
@@ -647,3 +685,20 @@ res_hostalias(const res_state statp, const char *name, char *dst, size_t siz) {
 	return (NULL);
 }
 libresolv_hidden_def (res_hostalias)
+
+const char *
+hostalias (const char *name)
+{
+  static char abuf[MAXDNAME];
+  return res_hostalias (&_res, name, abuf, sizeof abuf);
+}
+libresolv_hidden_def (hostalias)
+
+#if SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_2)
+# undef res_query
+# undef res_querydomain
+# undef res_search
+weak_alias (__res_query, res_query);
+weak_alias (__res_querydomain, res_querydomain);
+weak_alias (__res_search, res_search);
+#endif

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ded603542a8af41dc0c45af883d52390683f63aa

commit ded603542a8af41dc0c45af883d52390683f63aa
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Jun 30 11:31:47 2017 +0200

    resolv: Move res_isourserver, res_send from res_data.c to res_send.c

diff --git a/ChangeLog b/ChangeLog
index dca3cb2..5b5b0d1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2017-06-30  Florian Weimer  <fweimer@redhat.com>
 
+	* resolv/res_data.c (res_isourserver, res_send): Move to ...
+	* resolv/res_send.c (res_isourserver, res_send): here.
+
+2017-06-30  Florian Weimer  <fweimer@redhat.com>
+
 	* resolv/res_debug.c (_res_opcodes): Rename ...
 	(res_opcodes): ... as compatibility symbol.
 	(fp_nquery): Use res_opcodes.
diff --git a/resolv/res_data.c b/resolv/res_data.c
index d05389e..b790b4b 100644
--- a/resolv/res_data.c
+++ b/resolv/res_data.c
@@ -45,22 +45,6 @@ res_query(const char *name,	/* domain name */
 	return (res_nquery(&_res, name, class, type, answer, anslen));
 }
 
-int
-res_isourserver(const struct sockaddr_in *inp) {
-	return (res_ourserver_p(&_res, (const struct sockaddr_in6 *) inp));
-}
-
-int
-res_send(const u_char *buf, int buflen, u_char *ans, int anssiz) {
-	if (__res_maybe_init (&_res, 1) == -1) {
-		/* errno should have been set by res_init() in this case. */
-		return (-1);
-	}
-
-	return (res_nsend(&_res, buf, buflen, ans, anssiz));
-}
-
-
 void
 res_close(void) {
 	/*
diff --git a/resolv/res_send.c b/resolv/res_send.c
index 01b9b0e..a7daae8 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -243,6 +243,12 @@ res_ourserver_p(const res_state statp, const struct sockaddr_in6 *inp)
 	return (0);
 }
 
+int
+res_isourserver (const struct sockaddr_in *inp)
+{
+  return res_ourserver_p (&_res, (const struct sockaddr_in6 *) inp);
+}
+
 /* int
  * res_nameinquery(name, type, class, buf, eom)
  *	look for (name,type,class) in the query section of packet (buf,eom)
@@ -544,6 +550,15 @@ res_nsend(res_state statp,
 }
 libresolv_hidden_def (res_nsend)
 
+int
+res_send (const unsigned char *buf, int buflen, unsigned char *ans, int anssiz)
+{
+  if (__res_maybe_init (&_res, 1) == -1)
+    /* errno should have been set by res_init in this case.  */
+    return -1;
+  return res_nsend (&_res, buf, buflen, ans, anssiz);
+}
+
 /* Private */
 
 static struct sockaddr *

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=6781d8e693eb9e1251875222db5c9885d7ebb596

commit 6781d8e693eb9e1251875222db5c9885d7ebb596
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Jun 30 11:31:41 2017 +0200

    resolv: Turn _res_opcodes into a compatibility symbol

diff --git a/ChangeLog b/ChangeLog
index a396917..dca3cb2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2017-06-30  Florian Weimer  <fweimer@redhat.com>
 
+	* resolv/res_debug.c (_res_opcodes): Rename ...
+	(res_opcodes): ... as compatibility symbol.
+	(fp_nquery): Use res_opcodes.
+	* include/resolv.h (_res_opcodes): Remove declaration.
+
+2017-06-30  Florian Weimer  <fweimer@redhat.com>
+
 	* include/resolv.h (res_pquery): Remove declaration.
 	* resolv/res_data.c (fp_nquery, fp_query, p_query): Remove
 	functions.
diff --git a/NEWS b/NEWS
index 944804d..df6f394 100644
--- a/NEWS
+++ b/NEWS
@@ -234,6 +234,9 @@ Version 2.26
   will now randomly pick a name server from the configuration as a starting
   point.  (Previously, the second name server was always used.)
 
+* The _res_opcodes variable has been removed from libresolv.  It had been
+  exported by accident.
+
 Security related changes:
 
 * The DNS stub resolver limits the advertised UDP buffer size to 1200 bytes,
diff --git a/include/resolv.h b/include/resolv.h
index 4d5b51e..2938506 100644
--- a/include/resolv.h
+++ b/include/resolv.h
@@ -90,8 +90,5 @@ libresolv_hidden_proto (__b64_ntop)
 libresolv_hidden_proto (__dn_count_labels)
 libresolv_hidden_proto (__p_secstodate)
 
-extern const char *_res_opcodes[];
-libresolv_hidden_proto (_res_opcodes)
-
 # endif /* _RESOLV_H_ && !_ISOMAC */
 #endif
diff --git a/resolv/res_debug.c b/resolv/res_debug.c
index 182aeef..55d1fe9 100644
--- a/resolv/res_debug.c
+++ b/resolv/res_debug.c
@@ -106,6 +106,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
+#include <shlib-compat.h>
 
 #ifdef SPRINTF_CHAR
 # define SPRINTF(x) strlen(sprintf/**/x)
@@ -115,7 +116,12 @@
 
 extern const char *_res_sectioncodes[] attribute_hidden;
 
-const char *_res_opcodes[] =
+/* _res_opcodes was exported by accident as a variable.  */
+#if SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_26)
+static const char *res_opcodes[] =
+#else
+static const char res_opcodes[][9] =
+#endif
   {
     "QUERY",
     "IQUERY",
@@ -134,7 +140,9 @@ const char *_res_opcodes[] =
     "ZONEINIT",
     "ZONEREF",
   };
-libresolv_hidden_data_def (_res_opcodes)
+#if SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_26)
+strong_alias (res_opcodes, _res_opcodes)
+#endif
 
 static const char *p_section(int section, int opcode);
 
@@ -259,7 +267,7 @@ fp_nquery (const unsigned char *msg, int len, FILE *file)
 	if ((!pfcode) || (pfcode & RES_PRF_HEADX) || rcode)
 		fprintf(file,
 			";; ->>HEADER<<- opcode: %s, status: %s, id: %d\n",
-			_res_opcodes[opcode], p_rcode(rcode), id);
+			res_opcodes[opcode], p_rcode(rcode), id);
 	if ((!pfcode) || (pfcode & RES_PRF_HEADX))
 		putc(';', file);
 	if ((!pfcode) || (pfcode & RES_PRF_HEAD2)) {

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=d85f99679d89fb47426301620b7a980388fddcfd

commit d85f99679d89fb47426301620b7a980388fddcfd
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Jun 30 11:31:35 2017 +0200

    resolv: Move fp_nquery, fp_query, p_query, _res_opcodes
    
    From res_data.c to res_debug.c.
    
    Also drop the unnecessary _res initialization from fp_nquery.

diff --git a/ChangeLog b/ChangeLog
index de97c65..a396917 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2017-06-30  Florian Weimer  <fweimer@redhat.com>
 
+	* include/resolv.h (res_pquery): Remove declaration.
+	* resolv/res_data.c (fp_nquery, fp_query, p_query): Remove
+	functions.
+	(_res_opcodes): Remove variable.
+	* resolv/res_debug.c (do_section): Receive pfcode instead of
+	statp.
+	(res_pquery): Rename ...
+	(fp_nquery): to this function.  Skip unnecessary _res
+	initialization.
+	(fp_query, p_query, _res_opcodes): Copied from resolv/res_data.c.
+
+2017-06-30  Florian Weimer  <fweimer@redhat.com>
+
 	* resolv/res_debug.h: Remove file.
 	* resolv/README: Adjust.
 
diff --git a/include/resolv.h b/include/resolv.h
index 37e4047..4d5b51e 100644
--- a/include/resolv.h
+++ b/include/resolv.h
@@ -32,8 +32,6 @@ extern struct hostent *_gethtbyname2 (const char *__name, int __af);
 struct hostent *_gethtbyaddr (const char *addr, size_t __len, int __af);
 extern uint32_t _getlong (const unsigned char *__src);
 extern uint16_t _getshort (const unsigned char *__src);
-extern void res_pquery (const res_state __statp, const unsigned char *__msg,
-			int __len, FILE *__file);
 extern int res_ourserver_p (const res_state __statp,
 			    const struct sockaddr_in6 *__inp);
 extern void __res_iclose (res_state statp, bool free_addr);
diff --git a/resolv/res_data.c b/resolv/res_data.c
index d907bfc..d05389e 100644
--- a/resolv/res_data.c
+++ b/resolv/res_data.c
@@ -32,46 +32,6 @@
 #include <string.h>
 #include <unistd.h>
 
-const char *_res_opcodes[] = {
-	"QUERY",
-	"IQUERY",
-	"CQUERYM",
-	"CQUERYU",	/* experimental */
-	"NOTIFY",	/* experimental */
-	"UPDATE",
-	"6",
-	"7",
-	"8",
-	"9",
-	"10",
-	"11",
-	"12",
-	"13",
-	"ZONEINIT",
-	"ZONEREF",
-};
-libresolv_hidden_data_def (_res_opcodes)
-
-void
-p_query(const u_char *msg) {
-	fp_query(msg, stdout);
-}
-
-void
-fp_query(const u_char *msg, FILE *file) {
-	fp_nquery(msg, PACKETSZ, file);
-}
-libresolv_hidden_def (fp_query)
-
-void
-fp_nquery(const u_char *msg, int len, FILE *file) {
-	if (__res_maybe_init (&_res, 0) == -1)
-		return;
-
-	res_pquery(&_res, msg, len, file);
-}
-libresolv_hidden_def (fp_nquery)
-
 int
 res_query(const char *name,	/* domain name */
 	  int class, int type,	/* class and type of query */
diff --git a/resolv/res_debug.c b/resolv/res_debug.c
index e23559b..182aeef 100644
--- a/resolv/res_debug.c
+++ b/resolv/res_debug.c
@@ -115,6 +115,27 @@
 
 extern const char *_res_sectioncodes[] attribute_hidden;
 
+const char *_res_opcodes[] =
+  {
+    "QUERY",
+    "IQUERY",
+    "CQUERYM",
+    "CQUERYU",	/* experimental */
+    "NOTIFY",	/* experimental */
+    "UPDATE",
+    "6",
+    "7",
+    "8",
+    "9",
+    "10",
+    "11",
+    "12",
+    "13",
+    "ZONEINIT",
+    "ZONEREF",
+  };
+libresolv_hidden_data_def (_res_opcodes)
+
 static const char *p_section(int section, int opcode);
 
 /*
@@ -132,9 +153,7 @@ fp_resstat(const res_state statp, FILE *file) {
 }
 
 static void
-do_section(const res_state statp,
-	   ns_msg *handle, ns_sect section,
-	   int pflag, FILE *file)
+do_section (int pfcode, ns_msg *handle, ns_sect section, int pflag, FILE *file)
 {
 	int n, sflag, rrnum;
 	static int buflen = 2048;
@@ -145,8 +164,8 @@ do_section(const res_state statp,
 	/*
 	 * Print answer records.
 	 */
-	sflag = (statp->pfcode & pflag);
-	if (statp->pfcode && !sflag)
+	sflag = (pfcode & pflag);
+	if (pfcode && !sflag)
 		return;
 
 	buf = malloc(buflen);
@@ -163,11 +182,11 @@ do_section(const res_state statp,
 				fprintf(file, ";; ns_parserr: %s\n",
 					strerror(errno));
 			else if (rrnum > 0 && sflag != 0 &&
-				 (statp->pfcode & RES_PRF_HEAD1))
+				 (pfcode & RES_PRF_HEAD1))
 				putc('\n', file);
 			goto cleanup;
 		}
-		if (rrnum == 0 && sflag != 0 && (statp->pfcode & RES_PRF_HEAD1))
+		if (rrnum == 0 && sflag != 0 && (pfcode & RES_PRF_HEAD1))
 			fprintf(file, ";; %s SECTION:\n",
 				p_section(section, opcode));
 		if (section == ns_s_qd)
@@ -209,11 +228,19 @@ do_section(const res_state statp,
  * This is intended to be primarily a debugging routine.
  */
 void
-res_pquery(const res_state statp, const u_char *msg, int len, FILE *file) {
+fp_nquery (const unsigned char *msg, int len, FILE *file)
+{
 	ns_msg handle;
 	int qdcount, ancount, nscount, arcount;
 	u_int opcode, rcode, id;
 
+	/* There is no need to initialize _res: If _res is not yet
+	   initialized, _res.pfcode is zero.  But initialization will
+	   leave it at zero, too.  _res.pfcode is an unsigned long,
+	   but the code here assumes that the flags fit into an int,
+	   so use that.  */
+	int pfcode = _res.pfcode;
+
 	if (ns_initparse(msg, len, &handle) < 0) {
 		fprintf(file, ";; ns_initparse: %s\n", strerror(errno));
 		return;
@@ -229,13 +256,13 @@ res_pquery(const res_state statp, const u_char *msg, int len, FILE *file) {
 	/*
 	 * Print header fields.
 	 */
-	if ((!statp->pfcode) || (statp->pfcode & RES_PRF_HEADX) || rcode)
+	if ((!pfcode) || (pfcode & RES_PRF_HEADX) || rcode)
 		fprintf(file,
 			";; ->>HEADER<<- opcode: %s, status: %s, id: %d\n",
 			_res_opcodes[opcode], p_rcode(rcode), id);
-	if ((!statp->pfcode) || (statp->pfcode & RES_PRF_HEADX))
+	if ((!pfcode) || (pfcode & RES_PRF_HEADX))
 		putc(';', file);
-	if ((!statp->pfcode) || (statp->pfcode & RES_PRF_HEAD2)) {
+	if ((!pfcode) || (pfcode & RES_PRF_HEAD2)) {
 		fprintf(file, "; flags:");
 		if (ns_msg_getflag(handle, ns_f_qr))
 			fprintf(file, " qr");
@@ -254,7 +281,7 @@ res_pquery(const res_state statp, const u_char *msg, int len, FILE *file) {
 		if (ns_msg_getflag(handle, ns_f_cd))
 			fprintf(file, " cd");
 	}
-	if ((!statp->pfcode) || (statp->pfcode & RES_PRF_HEAD1)) {
+	if ((!pfcode) || (pfcode & RES_PRF_HEAD1)) {
 		fprintf(file, "; %s: %d",
 			p_section(ns_s_qd, opcode), qdcount);
 		fprintf(file, ", %s: %d",
@@ -264,21 +291,35 @@ res_pquery(const res_state statp, const u_char *msg, int len, FILE *file) {
 		fprintf(file, ", %s: %d",
 			p_section(ns_s_ar, opcode), arcount);
 	}
-	if ((!statp->pfcode) || (statp->pfcode &
+	if ((!pfcode) || (pfcode &
 		(RES_PRF_HEADX | RES_PRF_HEAD2 | RES_PRF_HEAD1))) {
 		putc('\n',file);
 	}
 	/*
 	 * Print the various sections.
 	 */
-	do_section(statp, &handle, ns_s_qd, RES_PRF_QUES, file);
-	do_section(statp, &handle, ns_s_an, RES_PRF_ANS, file);
-	do_section(statp, &handle, ns_s_ns, RES_PRF_AUTH, file);
-	do_section(statp, &handle, ns_s_ar, RES_PRF_ADD, file);
+	do_section (pfcode, &handle, ns_s_qd, RES_PRF_QUES, file);
+	do_section (pfcode, &handle, ns_s_an, RES_PRF_ANS, file);
+	do_section (pfcode, &handle, ns_s_ns, RES_PRF_AUTH, file);
+	do_section (pfcode, &handle, ns_s_ar, RES_PRF_ADD, file);
 	if (qdcount == 0 && ancount == 0 &&
 	    nscount == 0 && arcount == 0)
 		putc('\n', file);
 }
+libresolv_hidden_def (fp_nquery)
+
+void
+fp_query (const unsigned char *msg, FILE *file)
+{
+  fp_nquery (msg, PACKETSZ, file);
+}
+libresolv_hidden_def (fp_query)
+
+void
+p_query (const unsigned char *msg)
+{
+  fp_query (msg, stdout);
+}
 
 const u_char *
 p_cdnname(const u_char *cp, const u_char *msg, int len, FILE *file) {

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=4d4ce84924dbde90294522598212e997b5f719e9

commit 4d4ce84924dbde90294522598212e997b5f719e9
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Jun 30 11:31:29 2017 +0200

    resolv: Remove unused resolv/res_debug.h header file

diff --git a/ChangeLog b/ChangeLog
index a1ce2ef..de97c65 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2017-06-30  Florian Weimer  <fweimer@redhat.com>
 
+	* resolv/res_debug.h: Remove file.
+	* resolv/README: Adjust.
+
+2017-06-30  Florian Weimer  <fweimer@redhat.com>
+
 	* resolv/res_end.c (DEBUG): Remove macro and preprocessor
 	conditionals.
 	(Aerror, Perror): Remove function definitions.
diff --git a/resolv/README b/resolv/README
index c500251..514e9bb 100644
--- a/resolv/README
+++ b/resolv/README
@@ -114,7 +114,6 @@ src/lib/resolv/
   res_comp.c
   res_data.c
   res_debug.c
-  res_debug.h
   res_init.c
   res_mkquery.c
   res_query.c
diff --git a/resolv/res_debug.h b/resolv/res_debug.h
deleted file mode 100644
index 2d8ad15..0000000
--- a/resolv/res_debug.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 1999 by Internet Software Consortium.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- */
-
-#ifndef _RES_DEBUG_H_
-#define _RES_DEBUG_H_
-
-#ifndef DEBUG
-#   define Dprint(cond, args) /*empty*/
-#   define DprintQ(cond, args, query, size) /*empty*/
-#   define Aerror(statp, file, string, error, address) /*empty*/
-#   define Perror(statp, file, string, error) /*empty*/
-#else
-#   define Dprint(cond, args) if (cond) {fprintf args;} else {}
-#   define DprintQ(cond, args, query, size) if (cond) {\
-			fprintf args;\
-			res_pquery(statp, query, size, stdout);\
-		} else {}
-#endif
-
-#endif /* _RES_DEBUG_H_ */

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=09fbb56ad69b9e02fb3710a9234566536a96facf

commit 09fbb56ad69b9e02fb3710a9234566536a96facf
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Jun 30 11:31:23 2017 +0200

    resolv: Remove DEBUG from resolv/res_send.c

diff --git a/ChangeLog b/ChangeLog
index 0ec4e01..a1ce2ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2017-06-30  Florian Weimer  <fweimer@redhat.com>
 
+	* resolv/res_end.c (DEBUG): Remove macro and preprocessor
+	conditionals.
+	(Aerror, Perror): Remove function definitions.
+
+2017-06-30  Florian Weimer  <fweimer@redhat.com>
+
 	* resolv/res_data.c (res_mkquery): Move ...
 	* resolv/res_mkquery.c (res_mkquery): to here.
 
diff --git a/resolv/res_send.c b/resolv/res_send.c
index a1104b3..01b9b0e 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -103,7 +103,6 @@
 #include <netdb.h>
 #include <resolv/resolv-internal.h>
 #include <signal.h>
-#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
@@ -181,10 +180,6 @@ evNowTime(struct timespec *res) {
 }
 
 
-/* Options.  Leave them on. */
-/* #undef DEBUG */
-#include "res_debug.h"
-
 #define EXT(res) ((res)->_u._ext)
 
 /* Forward. */
@@ -199,11 +194,6 @@ static int		send_dg(res_state, const u_char *, int,
 				u_char **, int *, int *, int,
 				int *, int *, u_char **,
 				u_char **, int *, int *, int *);
-#ifdef DEBUG
-static void		Aerror(const res_state, FILE *, const char *, int,
-			       const struct sockaddr *);
-static void		Perror(const res_state, FILE *, const char *, int);
-#endif
 static int		sock_eq(struct sockaddr_in6 *, struct sockaddr_in6 *);
 
 /* Public. */
@@ -421,8 +411,6 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
 		return (-1);
 	}
 
-	DprintQ((statp->options & RES_DEBUG) || (statp->pfcode & RES_PRF_QUERY),
-		(stdout, ";; res_send()\n"), buf, buflen);
 	v_circuit = ((statp->options & RES_USEVC)
 		     || buflen > PACKETSZ
 		     || buflen2 > PACKETSZ);
@@ -492,20 +480,8 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
 		unsigned int ns = ns_shift + ns_offset;
 		if (ns >= statp->nscount)
 			ns -= statp->nscount;
-#ifdef DEBUG
-		char tmpbuf[40];
-		struct sockaddr *nsap = get_nsaddr (statp, ns);
-#endif
 
 	    same_ns:
-		Dprint(statp->options & RES_DEBUG,
-		       (stdout, ";; Querying server (# %d) address = %s\n",
-			ns + 1, inet_ntop(nsap->sa_family,
-					  (nsap->sa_family == AF_INET6
-					   ? (void *) &((struct sockaddr_in6 *) nsap)->sin6_addr
-					   : (void *) &((struct sockaddr_in *) nsap)->sin_addr),
-					  tmpbuf, sizeof (tmpbuf))));
-
 		if (__glibc_unlikely (v_circuit))       {
 			/* Use VC; at most one attempt per server. */
 			try = statp->retry;
@@ -535,22 +511,6 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
 
 		resplen = n;
 
-		Dprint((statp->options & RES_DEBUG) ||
-		       ((statp->pfcode & RES_PRF_REPLY) &&
-			(statp->pfcode & RES_PRF_HEAD1)),
-		       (stdout, ";; got answer:\n"));
-
-		DprintQ((statp->options & RES_DEBUG) ||
-			(statp->pfcode & RES_PRF_REPLY),
-			(stdout, "%s", ""),
-			ans, (resplen > anssiz) ? anssiz : resplen);
-		if (buf2 != NULL) {
-		  DprintQ((statp->options & RES_DEBUG) ||
-			  (statp->pfcode & RES_PRF_REPLY),
-			  (stdout, "%s", ""),
-			  *ansp2, (*resplen2 > *nansp2) ? *nansp2 : *resplen2);
-		}
-
 		/*
 		 * If we have temporarily opened a virtual circuit,
 		 * or if we haven't been asked to keep a socket open,
@@ -740,7 +700,6 @@ send_vc(res_state statp,
 		  (nsap->sa_family, SOCK_STREAM | SOCK_CLOEXEC, 0);
 		if (statp->_vcsock < 0) {
 			*terrno = errno;
-			Perror(statp, stderr, "socket(vc)", errno);
 			if (resplen2 != NULL)
 			  *resplen2 = 0;
 			return (-1);
@@ -751,7 +710,6 @@ send_vc(res_state statp,
 			    ? sizeof (struct sockaddr_in)
 			    : sizeof (struct sockaddr_in6)) < 0) {
 			*terrno = errno;
-			Aerror(statp, stderr, "connect/vc", errno, nsap);
 			return close_and_return_error (statp, resplen2);
 		}
 		statp->_flags |= RES_F_VC;
@@ -774,7 +732,6 @@ send_vc(res_state statp,
 	}
 	if (TEMP_FAILURE_RETRY (writev(statp->_vcsock, iov, niov)) != explen) {
 		*terrno = errno;
-		Perror(statp, stderr, "write failed", errno);
 		return close_and_return_error (statp, resplen2);
 	}
 	/*
@@ -796,7 +753,6 @@ send_vc(res_state statp,
 	}
 	if (n <= 0) {
 		*terrno = errno;
-		Perror(statp, stderr, "read failed", errno);
 		/*
 		 * A long running process might get its TCP
 		 * connection reset if the remote server was
@@ -859,9 +815,6 @@ send_vc(res_state statp,
 			   read RLEN bytes instead.  */
 			len = rlen;
 		} else {
-			Dprint(statp->options & RES_DEBUG,
-				(stdout, ";; response truncated\n")
-			);
 			truncating = 1;
 			len = *thisanssizp;
 		}
@@ -872,8 +825,6 @@ send_vc(res_state statp,
 		/*
 		 * Undersized message.
 		 */
-		Dprint(statp->options & RES_DEBUG,
-		       (stdout, ";; undersized: %d\n", len));
 		*terrno = EMSGSIZE;
 		return close_and_return_error (statp, resplen2);
 	}
@@ -885,7 +836,6 @@ send_vc(res_state statp,
 	}
 	if (__glibc_unlikely (n <= 0))       {
 		*terrno = errno;
-		Perror(statp, stderr, "read(vc)", errno);
 		return close_and_return_error (statp, resplen2);
 	}
 	if (__glibc_unlikely (truncating))       {
@@ -913,14 +863,8 @@ send_vc(res_state statp,
 	 * wait for the correct one.
 	 */
 	if ((recvresp1 || hp->id != anhp->id)
-	    && (recvresp2 || hp2->id != anhp->id)) {
-		DprintQ((statp->options & RES_DEBUG) ||
-			(statp->pfcode & RES_PRF_REPLY),
-			(stdout, ";; old answer (unexpected):\n"),
-			*thisansp,
-			(rlen > *thisanssizp) ? *thisanssizp: rlen);
+	    && (recvresp2 || hp2->id != anhp->id))
 		goto read_len;
-	}
 
 	/* Mark which reply we received.  */
 	if (recvresp1 == 0 && hp->id == anhp->id)
@@ -961,7 +905,6 @@ reopen (res_state statp, int *terrno, int ns)
 		}
 		if (EXT(statp).nssocks[ns] < 0) {
 			*terrno = errno;
-			Perror(statp, stderr, "socket(dg)", errno);
 			return (-1);
 		}
 
@@ -986,7 +929,6 @@ reopen (res_state statp, int *terrno, int ns)
 		DIAG_IGNORE_Os_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
 		if (connect(EXT(statp).nssocks[ns], nsap, slen) < 0) {
 		DIAG_POP_NEEDS_COMMENT;
-			Aerror(statp, stderr, "connect(dg)", errno, nsap);
 			__res_iclose(statp, false);
 			return (0);
 		}
@@ -1111,7 +1053,6 @@ send_dg(res_state statp,
 		evNowTime(&now);
 		if (evCmpTime(finish, now) <= 0) {
 		poll_err_out:
-			Perror(statp, stderr, "poll", errno);
 			return close_and_return_error (statp, resplen2);
 		}
 		evSubTime(&timeout, &finish, &now);
@@ -1128,7 +1069,6 @@ send_dg(res_state statp,
 		need_recompute = 1;
 	}
 	if (n == 0) {
-		Dprint(statp->options & RES_DEBUG, (stdout, ";; timeout\n"));
 		if (resplen > 1 && (recvresp1 || (buf2 != NULL && recvresp2)))
 		  {
 		    /* There are quite a few broken name servers out
@@ -1228,7 +1168,6 @@ send_dg(res_state statp,
 #endif
 
 		      fail_sendmmsg:
-			Perror(statp, stderr, "sendmmsg", errno);
 			return close_and_return_error (statp, resplen2);
 		      }
 		  }
@@ -1246,7 +1185,6 @@ send_dg(res_state statp,
 		    if (sr != (nwritten != 0 ? buflen2 : buflen)) {
 		      if (errno == EINTR || errno == EAGAIN)
 			goto recompute_resend;
-		      Perror(statp, stderr, "send", errno);
 		      return close_and_return_error (statp, resplen2);
 		    }
 		  just_one:
@@ -1307,12 +1245,6 @@ send_dg(res_state statp,
 		   MSG_TRUNC which is only available on Linux.  We
 		   can abstract out the Linux-specific feature in the
 		   future to detect truncation.  */
-		if (__glibc_unlikely (*thisanssizp < *thisresplenp)) {
-			Dprint(statp->options & RES_DEBUG,
-			       (stdout, ";; response may be truncated (UDP)\n")
-			);
-		}
-
 		HEADER *anhp = (HEADER *) *thisansp;
 		socklen_t fromlen = sizeof(struct sockaddr_in6);
 		assert (sizeof(from) <= fromlen);
@@ -1324,7 +1256,6 @@ send_dg(res_state statp,
 				need_recompute = 1;
 				goto wait;
 			}
-			Perror(statp, stderr, "recvfrom", errno);
 			return close_and_return_error (statp, resplen2);
 		}
 		*gotsomewhere = 1;
@@ -1332,9 +1263,6 @@ send_dg(res_state statp,
 			/*
 			 * Undersized message.
 			 */
-			Dprint(statp->options & RES_DEBUG,
-			       (stdout, ";; undersized: %d\n",
-				*thisresplenp));
 			*terrno = EMSGSIZE;
 			return close_and_return_error (statp, resplen2);
 		}
@@ -1345,12 +1273,6 @@ send_dg(res_state statp,
 			 * XXX - potential security hazard could
 			 *	 be detected here.
 			 */
-			DprintQ((statp->options & RES_DEBUG) ||
-				(statp->pfcode & RES_PRF_REPLY),
-				(stdout, ";; old answer:\n"),
-				*thisansp,
-				(*thisresplenp > *thisanssizp)
-				? *thisanssizp : *thisresplenp);
 			goto wait;
 		}
 		if (!(statp->options & RES_INSECURE1) &&
@@ -1360,12 +1282,6 @@ send_dg(res_state statp,
 			 * XXX - potential security hazard could
 			 *	 be detected here.
 			 */
-			DprintQ((statp->options & RES_DEBUG) ||
-				(statp->pfcode & RES_PRF_REPLY),
-				(stdout, ";; not our server:\n"),
-				*thisansp,
-				(*thisresplenp > *thisanssizp)
-				? *thisanssizp : *thisresplenp);
 			goto wait;
 		}
 		if (!(statp->options & RES_INSECURE2)
@@ -1382,23 +1298,11 @@ send_dg(res_state statp,
 			 * XXX - potential security hazard could
 			 *	 be detected here.
 			 */
-			DprintQ((statp->options & RES_DEBUG) ||
-				(statp->pfcode & RES_PRF_REPLY),
-				(stdout, ";; wrong query name:\n"),
-				*thisansp,
-				(*thisresplenp > *thisanssizp)
-				? *thisanssizp : *thisresplenp);
 			goto wait;
 		}
 		if (anhp->rcode == SERVFAIL ||
 		    anhp->rcode == NOTIMP ||
 		    anhp->rcode == REFUSED) {
-			DprintQ(statp->options & RES_DEBUG,
-				(stdout, "server rejected query:\n"),
-				*thisansp,
-				(*thisresplenp > *thisanssizp)
-				? *thisanssizp : *thisresplenp);
-
 		next_ns:
 			if (recvresp1 || (buf2 != NULL && recvresp2)) {
 			  *resplen2 = 0;
@@ -1424,11 +1328,6 @@ send_dg(res_state statp,
 		}
 		if (anhp->rcode == NOERROR && anhp->ancount == 0
 		    && anhp->aa == 0 && anhp->ra == 0 && anhp->arcount == 0) {
-			DprintQ(statp->options & RES_DEBUG,
-				(stdout, "referred query:\n"),
-				*thisansp,
-				(*thisresplenp > *thisanssizp)
-				? *thisanssizp : *thisresplenp);
 			goto next_ns;
 		}
 		if (!(statp->options & RES_IGNTC) && anhp->tc) {
@@ -1436,8 +1335,6 @@ send_dg(res_state statp,
 			 * To get the rest of answer,
 			 * use TCP with same server.
 			 */
-			Dprint(statp->options & RES_DEBUG,
-			       (stdout, ";; truncated answer\n"));
 			*v_circuit = 1;
 			__res_iclose(statp, false);
 			// XXX if we have received one reply we could
@@ -1481,46 +1378,6 @@ send_dg(res_state statp,
 	}
 }
 
-#ifdef DEBUG
-static void
-Aerror(const res_state statp, FILE *file, const char *string, int error,
-       const struct sockaddr *address)
-{
-	int save = errno;
-
-	if ((statp->options & RES_DEBUG) != 0) {
-		char tmp[sizeof "xxxx.xxxx.xxxx.255.255.255.255"];
-
-		fprintf(file, "res_send: %s ([%s].%u): %s\n",
-			string,
-			(address->sa_family == AF_INET
-			 ? inet_ntop(address->sa_family,
-				     &((const struct sockaddr_in *) address)->sin_addr,
-				     tmp, sizeof tmp)
-			 : inet_ntop(address->sa_family,
-				     &((const struct sockaddr_in6 *) address)->sin6_addr,
-				     tmp, sizeof tmp)),
-			(address->sa_family == AF_INET
-			 ? ntohs(((struct sockaddr_in *) address)->sin_port)
-			 : address->sa_family == AF_INET6
-			 ? ntohs(((struct sockaddr_in6 *) address)->sin6_port)
-			 : 0),
-			strerror(error));
-	}
-	__set_errno (save);
-}
-
-static void
-Perror(const res_state statp, FILE *file, const char *string, int error) {
-	int save = errno;
-
-	if ((statp->options & RES_DEBUG) != 0)
-		fprintf(file, "res_send: %s: %s\n",
-			string, strerror(error));
-	__set_errno (save);
-}
-#endif
-
 static int
 sock_eq(struct sockaddr_in6 *a1, struct sockaddr_in6 *a2) {
 	if (a1->sin6_family == a2->sin6_family) {

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=5ca4aaea1840b3005c2de4cc73269a55e34ae2c3

commit 5ca4aaea1840b3005c2de4cc73269a55e34ae2c3
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Jun 30 11:31:18 2017 +0200

    resolv: Move the res_mkquery function to the resolv/mk_query.c file

diff --git a/ChangeLog b/ChangeLog
index 64379a6..0ec4e01 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2017-06-30  Florian Weimer  <fweimer@redhat.com>
 
+	* resolv/res_data.c (res_mkquery): Move ...
+	* resolv/res_mkquery.c (res_mkquery): to here.
+
+2017-06-30  Florian Weimer  <fweimer@redhat.com>
+
 	* resolv/res_mkquery.c: Reformat to GNU style.
 	(T_OPT): Remove definition.  It is present in the header file.
 
diff --git a/resolv/res_data.c b/resolv/res_data.c
index 569ff4c..d907bfc 100644
--- a/resolv/res_data.c
+++ b/resolv/res_data.c
@@ -73,25 +73,6 @@ fp_nquery(const u_char *msg, int len, FILE *file) {
 libresolv_hidden_def (fp_nquery)
 
 int
-res_mkquery(int op,			/* opcode of query */
-	    const char *dname,		/* domain name */
-	    int class, int type,	/* class and type of query */
-	    const u_char *data,		/* resource record data */
-	    int datalen,		/* length of data */
-	    const u_char *newrr_in,	/* new rr for modify or append */
-	    u_char *buf,		/* buffer to put query */
-	    int buflen)			/* size of buffer */
-{
-	if (__res_maybe_init (&_res, 1) == -1) {
-		RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
-		return (-1);
-	}
-	return (res_nmkquery(&_res, op, dname, class, type,
-			     data, datalen,
-			     newrr_in, buf, buflen));
-}
-
-int
 res_query(const char *name,	/* domain name */
 	  int class, int type,	/* class and type of query */
 	  u_char *answer,	/* buffer to put answer */
@@ -180,11 +161,9 @@ libresolv_hidden_def (hostalias)
 #include <shlib-compat.h>
 
 #if SHLIB_COMPAT(libresolv, GLIBC_2_0, GLIBC_2_2)
-# undef res_mkquery
 # undef res_query
 # undef res_querydomain
 # undef res_search
-weak_alias (__res_mkquery, res_mkquery);
 weak_alias (__res_query, res_query);
 weak_alias (__res_querydomain, res_querydomain);
 weak_alias (__res_search, res_search);
diff --git a/resolv/res_mkquery.c b/resolv/res_mkquery.c
index a601b69..9afb410 100644
--- a/resolv/res_mkquery.c
+++ b/resolv/res_mkquery.c
@@ -90,6 +90,7 @@
 #include <resolv/resolv-internal.h>
 #include <string.h>
 #include <sys/time.h>
+#include <shlib-compat.h>
 
 #include <hp-timing.h>
 #include <stdint.h>
@@ -202,6 +203,21 @@ res_nmkquery (res_state statp, int op, const char *dname,
 }
 libresolv_hidden_def (res_nmkquery)
 
+int
+res_mkquery (int op, const char *dname, int class, int type,
+             const unsigned char *data, int datalen,
+             const unsigned char *newrr_in,
+             unsigned char *buf, int buflen)
+{
+  if (__res_maybe_init (&_res, 1) == -1)
+    {
+      RES_SET_H_ERRNO (&_res, NETDB_INTERNAL);
+      return -1;
+    }
+  return res_nmkquery (&_res, op, dname, class, type,
+                       data, datalen, newrr_in, buf, buflen);
+}
+
 /* Create an OPT resource record.  Return the length of the final
    packet, or -1 on error.
 
@@ -262,3 +278,8 @@ __res_nopt (res_state statp, int n0, unsigned char *buf, int buflen,
 
   return cp - buf;
 }
+
+#if SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_2)
+# undef res_mkquery
+weak_alias (__res_mkquery, res_mkquery);
+#endif

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=74084febc4b668ca2258d88cade6fa5e28364ac6

commit 74084febc4b668ca2258d88cade6fa5e28364ac6
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Jun 30 11:31:12 2017 +0200

    resolv: Reformat resolv/res_mkquery.c to GNU style

diff --git a/ChangeLog b/ChangeLog
index 956e8bd..64379a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2017-06-30  Florian Weimer  <fweimer@redhat.com>
 
+	* resolv/res_mkquery.c: Reformat to GNU style.
+	(T_OPT): Remove definition.  It is present in the header file.
+
+2017-06-30  Florian Weimer  <fweimer@redhat.com>
+
 	* resolv/res_mkquery.c (DEBUG): Remove macro and preprocessor
 	conditionals.
 
diff --git a/resolv/res_mkquery.c b/resolv/res_mkquery.c
index 2e3aa39..a601b69 100644
--- a/resolv/res_mkquery.c
+++ b/resolv/res_mkquery.c
@@ -97,172 +97,168 @@
 # define RANDOM_BITS(Var) { uint64_t v64; HP_TIMING_NOW (v64); Var = v64; }
 #endif
 
-/*
- * Form all types of queries.
- * Returns the size of the result or -1.
- */
+/* Form all types of queries.  Returns the size of the result or -1 on
+   error.
+
+   STATP points to an initialized resolver state.  OP is the opcode of
+   the query.  DNAME is the domain.  CLASS and TYPE are the DNS query
+   class and type.  DATA can be NULL; otherwise, it is a pointer to a
+   domain name which is included in the generated packet (if op ==
+   NS_NOTIFY_OP).  BUF must point to the out buffer of BUFLEN bytes.
+
+   DATALEN and NEWRR_IN are currently ignored.  */
 int
-res_nmkquery(res_state statp,
-	     int op,			/* opcode of query */
-	     const char *dname,		/* domain name */
-	     int class, int type,	/* class and type of query */
-	     const u_char *data,	/* resource record data */
-	     int datalen,		/* length of data */
-	     const u_char *newrr_in,	/* new rr for modify or append */
-	     u_char *buf,		/* buffer to put query */
-	     int buflen)		/* size of buffer */
+res_nmkquery (res_state statp, int op, const char *dname,
+              int class, int type,
+              const unsigned char *data, int datalen,
+              const unsigned char *newrr_in,
+              unsigned char *buf, int buflen)
 {
-	HEADER *hp;
-	u_char *cp;
-	int n;
-	u_char *dnptrs[20], **dpp, **lastdnptr;
+  HEADER *hp;
+  unsigned char *cp;
+  int n;
+  unsigned char *dnptrs[20], **dpp, **lastdnptr;
 
-	if (class < 0 || class > 65535
-	    || type < 0 || type > 65535)
-	  return -1;
+  if (class < 0 || class > 65535 || type < 0 || type > 65535)
+    return -1;
 
-	/*
-	 * Initialize header fields.
-	 */
-	if ((buf == NULL) || (buflen < HFIXEDSZ))
-		return (-1);
-	memset(buf, 0, HFIXEDSZ);
-	hp = (HEADER *) buf;
-	/* We randomize the IDs every time.  The old code just
-	   incremented by one after the initial randomization which
-	   still predictable if the application does multiple
-	   requests.  */
-	int randombits;
-	do
-	  {
+  /* Initialize header fields.  */
+  if ((buf == NULL) || (buflen < HFIXEDSZ))
+    return -1;
+  memset (buf, 0, HFIXEDSZ);
+  hp = (HEADER *) buf;
+  /* We randomize the IDs every time.  The old code just incremented
+     by one after the initial randomization which still predictable if
+     the application does multiple requests.  */
+  int randombits;
+  do
+    {
 #ifdef RANDOM_BITS
-	    RANDOM_BITS (randombits);
+      RANDOM_BITS (randombits);
 #else
-	    struct timeval tv;
-	    __gettimeofday (&tv, NULL);
-	    randombits = (tv.tv_sec << 8) ^ tv.tv_usec;
+      struct timeval tv;
+      __gettimeofday (&tv, NULL);
+      randombits = (tv.tv_sec << 8) ^ tv.tv_usec;
 #endif
-	  }
-	while ((randombits & 0xffff) == 0);
-	statp->id = (statp->id + randombits) & 0xffff;
-	hp->id = statp->id;
-	hp->opcode = op;
-	hp->rd = (statp->options & RES_RECURSE) != 0;
-	hp->rcode = NOERROR;
-	cp = buf + HFIXEDSZ;
-	buflen -= HFIXEDSZ;
-	dpp = dnptrs;
-	*dpp++ = buf;
-	*dpp++ = NULL;
-	lastdnptr = dnptrs + sizeof dnptrs / sizeof dnptrs[0];
-	/*
-	 * perform opcode specific processing
-	 */
-	switch (op) {
-	case NS_NOTIFY_OP:
-		if ((buflen -= QFIXEDSZ + (data == NULL ? 0 : RRFIXEDSZ)) < 0)
-			return (-1);
-		goto compose;
+    }
+  while ((randombits & 0xffff) == 0);
+
+  statp->id = (statp->id + randombits) & 0xffff;
+  hp->id = statp->id;
+  hp->opcode = op;
+  hp->rd = (statp->options & RES_RECURSE) != 0;
+  hp->rcode = NOERROR;
+  cp = buf + HFIXEDSZ;
+  buflen -= HFIXEDSZ;
+  dpp = dnptrs;
+  *dpp++ = buf;
+  *dpp++ = NULL;
+  lastdnptr = dnptrs + sizeof dnptrs / sizeof dnptrs[0];
 
-	case QUERY:
-		if ((buflen -= QFIXEDSZ) < 0)
-			return (-1);
-	compose:
-		n = ns_name_compress(dname, cp, buflen,
-				     (const u_char **) dnptrs,
-				     (const u_char **) lastdnptr);
-		if (n < 0)
-			return (-1);
-		cp += n;
-		buflen -= n;
-		NS_PUT16 (type, cp);
-		NS_PUT16 (class, cp);
-		hp->qdcount = htons(1);
-		if (op == QUERY || data == NULL)
-			break;
-		/*
-		 * Make an additional record for completion domain.
-		 */
-		n = ns_name_compress((char *)data, cp, buflen,
-				     (const u_char **) dnptrs,
-				     (const u_char **) lastdnptr);
-		if (__glibc_unlikely (n < 0))
-			return (-1);
-		cp += n;
-		buflen -= n;
-		NS_PUT16 (T_NULL, cp);
-		NS_PUT16 (class, cp);
-		NS_PUT32 (0, cp);
-		NS_PUT16 (0, cp);
-		hp->arcount = htons(1);
-		break;
+  /* Perform opcode specific processing.  */
+  switch (op)
+    {
+    case NS_NOTIFY_OP:
+      if ((buflen -= QFIXEDSZ + (data == NULL ? 0 : RRFIXEDSZ)) < 0)
+        return -1;
+      goto compose;
 
-	default:
-		return (-1);
-	}
-	return (cp - buf);
+    case QUERY:
+      if ((buflen -= QFIXEDSZ) < 0)
+        return -1;
+    compose:
+      n = ns_name_compress (dname, cp, buflen,
+                            (const unsigned char **) dnptrs,
+                            (const unsigned char **) lastdnptr);
+      if (n < 0)
+        return -1;
+      cp += n;
+      buflen -= n;
+      NS_PUT16 (type, cp);
+      NS_PUT16 (class, cp);
+      hp->qdcount = htons (1);
+      if (op == QUERY || data == NULL)
+        break;
+
+      /* Make an additional record for completion domain.  */
+      n = ns_name_compress ((char *)data, cp, buflen,
+                            (const unsigned char **) dnptrs,
+                            (const unsigned char **) lastdnptr);
+      if (__glibc_unlikely (n < 0))
+        return -1;
+      cp += n;
+      buflen -= n;
+      NS_PUT16 (T_NULL, cp);
+      NS_PUT16 (class, cp);
+      NS_PUT32 (0, cp);
+      NS_PUT16 (0, cp);
+      hp->arcount = htons (1);
+      break;
+
+    default:
+      return -1;
+    }
+  return cp - buf;
 }
 libresolv_hidden_def (res_nmkquery)
 
+/* Create an OPT resource record.  Return the length of the final
+   packet, or -1 on error.
 
-/* attach OPT pseudo-RR, as documented in RFC2671 (EDNS0). */
-#ifndef T_OPT
-#define T_OPT   41
-#endif
-
+   STATP must be an initialized resolver state.  N0 is the current
+   number of bytes of the packet (already written to BUF by the
+   aller).  BUF is the packet being constructed.  The array it
+   pointers to must be BUFLEN bytes long.  ANSLEN is the advertised
+   EDNS buffer size (to be included in the OPT resource record).  */
 int
-__res_nopt(res_state statp,
-	   int n0,                /* current offset in buffer */
-	   u_char *buf,           /* buffer to put query */
-	   int buflen,            /* size of buffer */
-	   int anslen)            /* UDP answer buffer size */
+__res_nopt (res_state statp, int n0, unsigned char *buf, int buflen,
+            int anslen)
 {
-	u_int16_t flags = 0;
-
-	HEADER *hp = (HEADER *) buf;
-	u_char *cp = buf + n0;
-	u_char *ep = buf + buflen;
+  uint16_t flags = 0;
+  HEADER *hp = (HEADER *) buf;
+  unsigned char *cp = buf + n0;
+  unsigned char *ep = buf + buflen;
 
-	if ((ep - cp) < 1 + RRFIXEDSZ)
-		return -1;
+  if ((ep - cp) < 1 + RRFIXEDSZ)
+    return -1;
 
-	*cp++ = 0;	/* "." */
+  /* Add the root label.  */
+  *cp++ = 0;
 
-	NS_PUT16(T_OPT, cp);	/* TYPE */
+  NS_PUT16 (T_OPT, cp);         /* Record type.  */
 
-	/* Lowering the advertised buffer size based on the actual
-	   answer buffer size is desirable because the server will
-	   minimize the reply to fit into the UDP packet (and A
-	   non-minimal response might not fit the buffer).
+  /* Lowering the advertised buffer size based on the actual
+     answer buffer size is desirable because the server will
+     minimize the reply to fit into the UDP packet (and A
+     non-minimal response might not fit the buffer).
 
-	   The RESOLV_EDNS_BUFFER_SIZE limit could still result in TCP
-	   fallback and a non-minimal response which has to be
-	   hard-truncated in the stub resolver, but this is price to
-	   pay for avoiding fragmentation.  (This issue does not
-	   affect the nss_dns functions because they use the stub
-	   resolver in such a way that it allocates a properly sized
-	   response buffer.)  */
-	{
-	  uint16_t buffer_size;
-	  if (anslen < 512)
-	    buffer_size = 512;
-	  else if (anslen > RESOLV_EDNS_BUFFER_SIZE)
-	    buffer_size = RESOLV_EDNS_BUFFER_SIZE;
-	  else
-	    buffer_size = anslen;
-	  NS_PUT16 (buffer_size, cp);
-	}
+     The RESOLV_EDNS_BUFFER_SIZE limit could still result in TCP
+     fallback and a non-minimal response which has to be
+     hard-truncated in the stub resolver, but this is price to
+     pay for avoiding fragmentation.  (This issue does not
+     affect the nss_dns functions because they use the stub
+     resolver in such a way that it allocates a properly sized
+     response buffer.)  */
+  {
+    uint16_t buffer_size;
+    if (anslen < 512)
+      buffer_size = 512;
+    else if (anslen > RESOLV_EDNS_BUFFER_SIZE)
+      buffer_size = RESOLV_EDNS_BUFFER_SIZE;
+    else
+      buffer_size = anslen;
+    NS_PUT16 (buffer_size, cp);
+  }
 
-	*cp++ = NOERROR;	/* extended RCODE */
-	*cp++ = 0;		/* EDNS version */
+  *cp++ = NOERROR;              /* Extended RCODE.  */
+  *cp++ = 0;                    /* EDNS version.  */
 
-	if (statp->options & RES_USE_DNSSEC) {
-		flags |= NS_OPT_DNSSEC_OK;
-	}
+  if (statp->options & RES_USE_DNSSEC)
+    flags |= NS_OPT_DNSSEC_OK;
 
-	NS_PUT16(flags, cp);
-	NS_PUT16(0, cp);	/* RDLEN */
-	hp->arcount = htons(ntohs(hp->arcount) + 1);
+  NS_PUT16 (flags, cp);
+  NS_PUT16 (0, cp);       /* RDATA length (no options are preent).  */
+  hp->arcount = htons (ntohs (hp->arcount) + 1);
 
-	return cp - buf;
+  return cp - buf;
 }

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=7ab27b76d2d47942bc2ed74f674b62c3a51994bb

commit 7ab27b76d2d47942bc2ed74f674b62c3a51994bb
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Jun 30 11:31:02 2017 +0200

    resolv: Remove DEBUG macro from resolv/res_mkquery.c

diff --git a/ChangeLog b/ChangeLog
index b340c7f..956e8bd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2017-06-30  Florian Weimer  <fweimer@redhat.com>
 
+	* resolv/res_mkquery.c (DEBUG): Remove macro and preprocessor
+	conditionals.
+
+2017-06-30  Florian Weimer  <fweimer@redhat.com>
+
 	* support/support_capture_subprocess_check.c
 	(support_capture_subprocess_check): Report actual exit status.
 
diff --git a/resolv/res_mkquery.c b/resolv/res_mkquery.c
index 8279d15..2e3aa39 100644
--- a/resolv/res_mkquery.c
+++ b/resolv/res_mkquery.c
@@ -1,3 +1,21 @@
+/* Creation of DNS query packets.
+   Copyright (C) 1995-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
 /*
  * Copyright (c) 1985, 1993
  *    The Regents of the University of California.  All rights reserved.
@@ -70,13 +88,9 @@
 #include <arpa/nameser.h>
 #include <netdb.h>
 #include <resolv/resolv-internal.h>
-#include <stdio.h>
 #include <string.h>
 #include <sys/time.h>
 
-/* Options.  Leave them on. */
-/* #define DEBUG */
-
 #include <hp-timing.h>
 #include <stdint.h>
 #if HP_TIMING_AVAIL
@@ -107,11 +121,6 @@ res_nmkquery(res_state statp,
 	    || type < 0 || type > 65535)
 	  return -1;
 
-#ifdef DEBUG
-	if (statp->options & RES_DEBUG)
-		printf(";; res_nmkquery(%s, %s, %s, %s)\n",
-		       _res_opcodes[op], dname, p_class(class), p_type(type));
-#endif
 	/*
 	 * Initialize header fields.
 	 */
@@ -210,11 +219,6 @@ __res_nopt(res_state statp,
 {
 	u_int16_t flags = 0;
 
-#ifdef DEBUG
-	if ((statp->options & RES_DEBUG) != 0U)
-		printf(";; res_nopt()\n");
-#endif
-
 	HEADER *hp = (HEADER *) buf;
 	u_char *cp = buf + n0;
 	u_char *ep = buf + buflen;
@@ -253,10 +257,6 @@ __res_nopt(res_state statp,
 	*cp++ = 0;		/* EDNS version */
 
 	if (statp->options & RES_USE_DNSSEC) {
-#ifdef DEBUG
-		if (statp->options & RES_DEBUG)
-			printf(";; res_opt()... ENDS0 DNSSEC\n");
-#endif
 		flags |= NS_OPT_DNSSEC_OK;
 	}
 

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=5f17245d3e30ce9510a4061cf2a277cd8f6a815f

commit 5f17245d3e30ce9510a4061cf2a277cd8f6a815f
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Jun 30 11:30:48 2017 +0200

    support: Report actual exit status in support_capture_subprocess_check

diff --git a/ChangeLog b/ChangeLog
index 108f8cd..b340c7f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2017-06-30  Florian Weimer  <fweimer@redhat.com>
 
+	* support/support_capture_subprocess_check.c
+	(support_capture_subprocess_check): Report actual exit status.
+
+2017-06-30  Florian Weimer  <fweimer@redhat.com>
+
 	[BZ #19570]
 	* resolv/res_send.c (nameserver_offset): New function.
 	(__libc_res_nsend): Use it to implement RES_ROTATE.
diff --git a/support/support_capture_subprocess_check.c b/support/support_capture_subprocess_check.c
index 708c89f..e1cf73b 100644
--- a/support/support_capture_subprocess_check.c
+++ b/support/support_capture_subprocess_check.c
@@ -48,7 +48,7 @@ support_capture_subprocess_check (struct support_capture_subprocess *proc,
     {
       print_context (context, &failed);
       printf ("error:   expected exit status: %d\n", status);
-      printf ("error:   actual exit status:   %d\n", status);
+      printf ("error:   actual exit status:   %d\n", proc->status);
     }
   if (!(allowed & sc_allow_stdout) && proc->out.length != 0)
     {

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                  |   77 +++++++
 NEWS                                       |    3 +
 include/resolv.h                           |    5 -
 resolv/README                              |    1 -
 resolv/res_data.c                          |  201 +++--------------
 resolv/res_debug.c                         |   85 ++++++--
 resolv/res_debug.h                         |   34 ---
 resolv/res_init.c                          |    8 +-
 resolv/res_mkquery.c                       |  339 +++++++++++++++-------------
 resolv/res_query.c                         |   93 +++++---
 resolv/res_send.c                          |  160 ++------------
 support/support_capture_subprocess_check.c |    2 +-
 12 files changed, 434 insertions(+), 574 deletions(-)
 delete mode 100644 resolv/res_debug.h


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]