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-511-g89f187a


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  89f187a40fc0ad4e22838526bfe34d73f758b776 (commit)
       via  ea4924ce5bccfccc4e8a492faa96933131abd9ef (commit)
       via  4c4480eecb2e00764dd3bf79d68ea4e1d747d78c (commit)
       via  94f094f22b50a20de9042cb1e78c7299992a91c9 (commit)
       via  e68111fbd63e84b66bd9e03b42721c79230b9b6d (commit)
       via  e4e5b57d23b4ebdbf773fedba91160158f95af94 (commit)
       via  26bf5a1029434c98db85947eed11ce3090b2f5db (commit)
       via  ca3d65ff69d5187cb4d6b7f81d414427c7007e22 (commit)
      from  487549c466e1434e812ca8877dd487398bc2df4e (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=89f187a40fc0ad4e22838526bfe34d73f758b776

commit 89f187a40fc0ad4e22838526bfe34d73f758b776
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Jun 16 20:54:43 2017 +0200

    resolv: Use getline for configuration file reading in res_vinit_1

diff --git a/ChangeLog b/ChangeLog
index 387f038..70d2ea9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-06-16  Florian Weimer  <fweimer@redhat.com>
+
+	* resolv/res_init.c (res_vinit_1): Use getline to read from the
+	configuration file.
+	(__res_vinit): Adjust.
+
 2017-06-19  Florian Weimer  <fweimer@redhat.com>
 
 	* resolv/res_init.c (res_vinit_1): New function.
diff --git a/resolv/res_init.c b/resolv/res_init.c
index e604a02..ed5a4d4 100644
--- a/resolv/res_init.c
+++ b/resolv/res_init.c
@@ -126,10 +126,10 @@ is_sort_mask (char ch)
    deallocation and error handling.  Return true on success, false on
    failure.  */
 static bool
-res_vinit_1 (res_state statp, bool preinit, FILE *fp)
+res_vinit_1 (res_state statp, bool preinit, FILE *fp, char **buffer)
 {
   char *cp, **pp;
-  char buf[BUFSIZ];
+  size_t buffer_size = 0;
   int nserv = 0;    /* Number of nameservers read from file.  */
   bool have_serv6 = false;
   bool haveenv = false;
@@ -197,27 +197,38 @@ res_vinit_1 (res_state statp, bool preinit, FILE *fp)
     }
 
 #define MATCH(line, name)                       \
-  (!strncmp (line, name, sizeof (name) - 1)     \
-   && (line[sizeof (name) - 1] == ' '           \
-       || line[sizeof (name) - 1] == '\t'))
+  (!strncmp ((line), name, sizeof (name) - 1)     \
+   && ((line)[sizeof (name) - 1] == ' '           \
+       || (line)[sizeof (name) - 1] == '\t'))
 
   if (fp != NULL)
     {
       /* No threads use this stream.  */
       __fsetlocking (fp, FSETLOCKING_BYCALLER);
       /* Read the config file.  */
-      while (__fgets_unlocked (buf, sizeof (buf), fp) != NULL)
+      while (true)
         {
+          {
+            ssize_t ret = __getline (buffer, &buffer_size, fp);
+            if (ret <= 0)
+              {
+                if (_IO_ferror_unlocked (fp))
+                  return false;
+                else
+                  break;
+              }
+          }
+
           /* Skip comments.  */
-          if (*buf == ';' || *buf == '#')
+          if (**buffer == ';' || **buffer == '#')
             continue;
           /* Read default domain name.  */
-          if (MATCH (buf, "domain"))
+          if (MATCH (*buffer, "domain"))
             {
               if (haveenv)
                 /* LOCALDOMAIN overrides the configuration file.  */
                 continue;
-              cp = buf + sizeof ("domain") - 1;
+              cp = *buffer + sizeof ("domain") - 1;
               while (*cp == ' ' || *cp == '\t')
                 cp++;
               if ((*cp == '\0') || (*cp == '\n'))
@@ -230,12 +241,12 @@ res_vinit_1 (res_state statp, bool preinit, FILE *fp)
               continue;
             }
           /* Set search list.  */
-          if (MATCH (buf, "search"))
+          if (MATCH (*buffer, "search"))
             {
               if (haveenv)
                 /* LOCALDOMAIN overrides the configuration file.  */
                 continue;
-              cp = buf + sizeof ("search") - 1;
+              cp = *buffer + sizeof ("search") - 1;
               while (*cp == ' ' || *cp == '\t')
                 cp++;
               if ((*cp == '\0') || (*cp == '\n'))
@@ -271,11 +282,11 @@ res_vinit_1 (res_state statp, bool preinit, FILE *fp)
               continue;
             }
           /* Read nameservers to query.  */
-          if (MATCH (buf, "nameserver") && nserv < MAXNS)
+          if (MATCH (*buffer, "nameserver") && nserv < MAXNS)
             {
               struct in_addr a;
 
-              cp = buf + sizeof ("nameserver") - 1;
+              cp = *buffer + sizeof ("nameserver") - 1;
               while (*cp == ' ' || *cp == '\t')
                 cp++;
               if ((*cp != '\0') && (*cp != '\n') && __inet_aton (cp, &a))
@@ -300,7 +311,7 @@ res_vinit_1 (res_state statp, bool preinit, FILE *fp)
 
                       sa6 = malloc (sizeof (*sa6));
                       if (sa6 == NULL)
-                        return -1;
+                        return false;
 
                       sa6->sin6_family = AF_INET6;
                       sa6->sin6_port = htons (NAMESERVER_PORT);
@@ -323,11 +334,11 @@ res_vinit_1 (res_state statp, bool preinit, FILE *fp)
                 }
               continue;
             }
-          if (MATCH (buf, "sortlist"))
+          if (MATCH (*buffer, "sortlist"))
             {
               struct in_addr a;
 
-              cp = buf + sizeof ("sortlist") - 1;
+              cp = *buffer + sizeof ("sortlist") - 1;
               while (nsort < MAXRESOLVSORT)
                 {
                   while (*cp == ' ' || *cp == '\t')
@@ -367,9 +378,9 @@ res_vinit_1 (res_state statp, bool preinit, FILE *fp)
                 }
               continue;
             }
-          if (MATCH (buf, "options"))
+          if (MATCH (*buffer, "options"))
             {
-              res_setoptions (statp, buf + sizeof ("options") - 1, "conf");
+              res_setoptions (statp, *buffer + sizeof ("options") - 1, "conf");
               continue;
             }
         }
@@ -387,10 +398,13 @@ res_vinit_1 (res_state statp, bool preinit, FILE *fp)
       statp->nsaddr.sin_port = htons (NAMESERVER_PORT);
       statp->nscount = 1;
     }
-  if (statp->defdname[0] == 0
-      && __gethostname (buf, sizeof (statp->defdname) - 1) == 0
-      && (cp = strchr (buf, '.')) != NULL)
-    strcpy (statp->defdname, cp + 1);
+  if (statp->defdname[0] == 0)
+    {
+      char buf[sizeof (statp->defdname)];
+      if (__gethostname (buf, sizeof (statp->defdname) - 1) == 0
+          && (cp = strchr (buf, '.')) != NULL)
+        strcpy (statp->defdname, cp + 1);
+    }
 
   /* Find components of local domain that might be searched.  */
   if (!havesearch)
@@ -404,7 +418,7 @@ res_vinit_1 (res_state statp, bool preinit, FILE *fp)
   if ((cp = getenv ("RES_OPTIONS")) != NULL)
     res_setoptions (statp, cp, "env");
   statp->options |= RES_INIT;
-  return 0;
+  return true;
 }
 
 /* Set up default settings.  If the /etc/resolv.conf configuration
@@ -434,7 +448,12 @@ __res_vinit (res_state statp, int preinit)
            need to be handled by the application.  */
         return -1;
       }
-  if (!res_vinit_1 (statp, preinit, fp))
+
+  char *buffer = NULL;
+  bool ok = res_vinit_1 (statp, preinit, fp, &buffer);
+  free (buffer);
+
+  if (!ok)
     {
       /* Deallocate the name server addresses which have been
          allocated.  */

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

commit ea4924ce5bccfccc4e8a492faa96933131abd9ef
Author: Florian Weimer <fweimer@redhat.com>
Date:   Mon Jun 19 14:05:49 2017 +0200

    resolv: Report allocation errors in __res_vinit

diff --git a/ChangeLog b/ChangeLog
index 6e57e98..387f038 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2017-06-19  Florian Weimer  <fweimer@redhat.com>
 
+	* resolv/res_init.c (res_vinit_1): New function.
+	(__res_vinit): Call it.  Handle file open and memory allocation
+	failures.
+	* resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname3_r): Propagate
+	erno from __res_maybe_init failure.
+	(_nss_dns_gethostbyname4_r): Likewise.
+	(_nss_dns_gethostbyaddr2_r): Likewise.
+	* resolv/nss_dns/dns-network.c (_nss_dns_getnetbyname_r): Likewise.
+	(_nss_dns_getnetbyaddr_r): Likewise.
+
+2017-06-19  Florian Weimer  <fweimer@redhat.com>
+
 	* resolv/res_init.c: Reformat to GNU style.
 
 2017-06-19  Florian Weimer  <fweimer@redhat.com>
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index f121aa3..206924d 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -164,7 +164,11 @@ _nss_dns_gethostbyname3_r (const char *name, int af, struct hostent *result,
   enum nss_status status;
 
   if (__res_maybe_init (&_res, 0) == -1)
-    return NSS_STATUS_UNAVAIL;
+    {
+      *errnop = errno;
+      *h_errnop = NETDB_INTERNAL;
+      return NSS_STATUS_UNAVAIL;
+    }
 
   switch (af) {
   case AF_INET:
@@ -289,7 +293,11 @@ _nss_dns_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
 			   int *herrnop, int32_t *ttlp)
 {
   if (__res_maybe_init (&_res, 0) == -1)
-    return NSS_STATUS_UNAVAIL;
+    {
+      *errnop = errno;
+      *herrnop = NETDB_INTERNAL;
+      return NSS_STATUS_UNAVAIL;
+    }
 
   /*
    * if there aren't any dots, it could be a user-level alias.
@@ -416,7 +424,11 @@ _nss_dns_gethostbyaddr2_r (const void *addr, socklen_t len, int af,
  host_data = (struct host_data *) buffer;
 
   if (__res_maybe_init (&_res, 0) == -1)
-    return NSS_STATUS_UNAVAIL;
+    {
+      *errnop = errno;
+      *h_errnop = NETDB_INTERNAL;
+      return NSS_STATUS_UNAVAIL;
+    }
 
   if (af == AF_INET6 && len == IN6ADDRSZ
       && (memcmp (uaddr, mapped, sizeof mapped) == 0
diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c
index 2be72d3..dc1599b 100644
--- a/resolv/nss_dns/dns-network.c
+++ b/resolv/nss_dns/dns-network.c
@@ -116,7 +116,11 @@ _nss_dns_getnetbyname_r (const char *name, struct netent *result,
   enum nss_status status;
 
   if (__res_maybe_init (&_res, 0) == -1)
-    return NSS_STATUS_UNAVAIL;
+    {
+      *errnop = errno;
+      *herrnop = NETDB_INTERNAL;
+      return NSS_STATUS_UNAVAIL;
+    }
 
   net_buffer.buf = orig_net_buffer = (querybuf *) alloca (1024);
 
@@ -166,7 +170,11 @@ _nss_dns_getnetbyaddr_r (uint32_t net, int type, struct netent *result,
     return NSS_STATUS_UNAVAIL;
 
   if (__res_maybe_init (&_res, 0) == -1)
-    return NSS_STATUS_UNAVAIL;
+    {
+      *errnop = errno;
+      *herrnop = NETDB_INTERNAL;
+      return NSS_STATUS_UNAVAIL;
+    }
 
   net2 = (u_int32_t) net;
   for (cnt = 4; net2 != 0; net2 >>= 8)
diff --git a/resolv/res_init.c b/resolv/res_init.c
index 49fc945..e604a02 100644
--- a/resolv/res_init.c
+++ b/resolv/res_init.c
@@ -100,6 +100,7 @@
 #include <sys/time.h>
 #include <sys/types.h>
 #include <inet/net-internal.h>
+#include <errno.h>
 
 static void res_setoptions (res_state, const char *, const char *);
 static uint32_t net_mask (struct in_addr);
@@ -121,14 +122,11 @@ is_sort_mask (char ch)
   return ch == '/' || ch == '&';
 }
 
-/* Set up default settings.  If the /etc/resolv.conf configuration
-   file exist, the values there will have precedence.  Otherwise, the
-   server address is set to INADDR_LOOPBACK and the default domain
-   name comes from gethostname.  The RES_OPTIONS and LOCALDOMAIN
-   environment variables can be used to override some settings.
-   Return 0 if completes successfully, -1 on error.  */
-int
-__res_vinit (res_state statp, int preinit)
+/* Internal helper function for __res_vinit, to aid with resource
+   deallocation and error handling.  Return true on success, false on
+   failure.  */
+static bool
+res_vinit_1 (res_state statp, bool preinit, FILE *fp)
 {
   char *cp, **pp;
   char buf[BUFSIZ];
@@ -203,7 +201,6 @@ __res_vinit (res_state statp, int preinit)
    && (line[sizeof (name) - 1] == ' '           \
        || line[sizeof (name) - 1] == '\t'))
 
-  FILE *fp = fopen (_PATH_RESCONF, "rce");
   if (fp != NULL)
     {
       /* No threads use this stream.  */
@@ -302,26 +299,26 @@ __res_vinit (res_state statp, int preinit)
                       struct sockaddr_in6 *sa6;
 
                       sa6 = malloc (sizeof (*sa6));
-                      if (sa6 != NULL)
-                        {
-                          sa6->sin6_family = AF_INET6;
-                          sa6->sin6_port = htons (NAMESERVER_PORT);
-                          sa6->sin6_flowinfo = 0;
-                          sa6->sin6_addr = a6;
-
-                          sa6->sin6_scope_id = 0;
-                          if (__glibc_likely (el != NULL))
-                            /* Ignore errors, for backwards
-                               compatibility.  */
-                            __inet6_scopeid_pton
-                              (&a6, el + 1, &sa6->sin6_scope_id);
-
-                          statp->nsaddr_list[nserv].sin_family = 0;
-                          statp->_u._ext.nsaddrs[nserv] = sa6;
-                          statp->_u._ext.nssocks[nserv] = -1;
-                          have_serv6 = true;
-                          nserv++;
-                        }
+                      if (sa6 == NULL)
+                        return -1;
+
+                      sa6->sin6_family = AF_INET6;
+                      sa6->sin6_port = htons (NAMESERVER_PORT);
+                      sa6->sin6_flowinfo = 0;
+                      sa6->sin6_addr = a6;
+
+                      sa6->sin6_scope_id = 0;
+                      if (__glibc_likely (el != NULL))
+                        /* Ignore errors, for backwards
+                           compatibility.  */
+                        __inet6_scopeid_pton
+                          (&a6, el + 1, &sa6->sin6_scope_id);
+
+                      statp->nsaddr_list[nserv].sin_family = 0;
+                      statp->_u._ext.nsaddrs[nserv] = sa6;
+                      statp->_u._ext.nssocks[nserv] = -1;
+                      have_serv6 = true;
+                      nserv++;
                     }
                 }
               continue;
@@ -410,6 +407,44 @@ __res_vinit (res_state statp, int preinit)
   return 0;
 }
 
+/* Set up default settings.  If the /etc/resolv.conf configuration
+   file exist, the values there will have precedence.  Otherwise, the
+   server address is set to INADDR_LOOPBACK and the default domain
+   name comes from gethostname.  The RES_OPTIONS and LOCALDOMAIN
+   environment variables can be used to override some settings.
+   Return 0 if completes successfully, -1 on error.  */
+int
+__res_vinit (res_state statp, int preinit)
+{
+  FILE *fp = fopen (_PATH_RESCONF, "rce");
+  if (fp == NULL)
+    switch (errno)
+      {
+      case EACCES:
+      case EISDIR:
+      case ELOOP:
+      case ENOENT:
+      case ENOTDIR:
+      case EPERM:
+        /* Ignore these errors.  They are persistent errors caused
+           by file system contents.  */
+        break;
+      default:
+        /* Other errors refer to resource allocation problems and
+           need to be handled by the application.  */
+        return -1;
+      }
+  if (!res_vinit_1 (statp, preinit, fp))
+    {
+      /* Deallocate the name server addresses which have been
+         allocated.  */
+      for (int n = 0; n < MAXNS; n++)
+        free (statp->_u._ext.nsaddrs[n]);
+      return -1;
+    }
+  return 0;
+}
+
 static void
 res_setoptions (res_state statp, const char *options, const char *source)
 {

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

commit 4c4480eecb2e00764dd3bf79d68ea4e1d747d78c
Author: Florian Weimer <fweimer@redhat.com>
Date:   Mon Jun 19 13:20:46 2017 +0200

    resolv: Reformat res_vinit and related functions to GNU style
    
    Also remove some obsolete comments.

diff --git a/ChangeLog b/ChangeLog
index da00dbd..6e57e98 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2017-06-19  Florian Weimer  <fweimer@redhat.com>
 
+	* resolv/res_init.c: Reformat to GNU style.
+
+2017-06-19  Florian Weimer  <fweimer@redhat.com>
+
 	* resolv/res_init.c (sort_mask_chars, ISSORTMASK): Remove.
 	(is_sort_mask): New function.
 	(__res_vinit): Use it.
diff --git a/resolv/res_init.c b/resolv/res_init.c
index eb8e308..49fc945 100644
--- a/resolv/res_init.c
+++ b/resolv/res_init.c
@@ -1,3 +1,21 @@
+/* Resolver state initialization and resolv.conf parsing.
+   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, 1989, 1993
  *    The Regents of the University of California.  All rights reserved.
@@ -83,26 +101,15 @@
 #include <sys/types.h>
 #include <inet/net-internal.h>
 
-static void res_setoptions (res_state, const char *, const char *)
-     internal_function;
-static u_int32_t net_mask (struct in_addr) __THROW;
+static void res_setoptions (res_state, const char *, const char *);
+static uint32_t net_mask (struct in_addr);
 
 unsigned long long int __res_initstamp attribute_hidden;
 
-/*
- * Resolver state default settings.
- */
-
-/*
- * Set up default settings.  If the configuration file exist, the values
- * there will have precedence.  Otherwise, the server address is set to
- * INADDR_LOOPBACK and the default domain name comes from gethostname.
- *
- * Return 0 if completes successfully, -1 on error
- */
 int
-res_ninit(res_state statp) {
-	return (__res_vinit(statp, 0));
+res_ninit (res_state statp)
+{
+  return __res_vinit (statp, 0);
 }
 libc_hidden_def (__res_ninit)
 
@@ -114,349 +121,374 @@ is_sort_mask (char ch)
   return ch == '/' || ch == '&';
 }
 
-/* This function has to be reachable by res_data.c but not publically. */
+/* Set up default settings.  If the /etc/resolv.conf configuration
+   file exist, the values there will have precedence.  Otherwise, the
+   server address is set to INADDR_LOOPBACK and the default domain
+   name comes from gethostname.  The RES_OPTIONS and LOCALDOMAIN
+   environment variables can be used to override some settings.
+   Return 0 if completes successfully, -1 on error.  */
 int
-__res_vinit(res_state statp, int preinit) {
-	FILE *fp;
-	char *cp, **pp;
-	int n;
-	char buf[BUFSIZ];
-	int nserv = 0;    /* number of nameservers read from file */
-	int have_serv6 = 0;
-	int haveenv = 0;
-	int havesearch = 0;
-	int nsort = 0;
-	char *net;
-	statp->_u._ext.initstamp = __res_initstamp;
+__res_vinit (res_state statp, int preinit)
+{
+  char *cp, **pp;
+  char buf[BUFSIZ];
+  int nserv = 0;    /* Number of nameservers read from file.  */
+  bool have_serv6 = false;
+  bool haveenv = false;
+  bool havesearch = false;
+  int nsort = 0;
+  char *net;
+  statp->_u._ext.initstamp = __res_initstamp;
 
-	if (!preinit) {
-		statp->retrans = RES_TIMEOUT;
-		statp->retry = RES_DFLRETRY;
-		statp->options = RES_DEFAULT;
-		statp->id = res_randomid();
-	}
+  if (!preinit)
+    {
+      statp->retrans = RES_TIMEOUT;
+      statp->retry = RES_DFLRETRY;
+      statp->options = RES_DEFAULT;
+      statp->id = res_randomid ();
+    }
 
-	statp->nscount = 0;
-	statp->defdname[0] = '\0';
-	statp->ndots = 1;
-	statp->pfcode = 0;
-	statp->_vcsock = -1;
-	statp->_flags = 0;
-	statp->__glibc_unused_qhook = NULL;
-	statp->__glibc_unused_rhook = NULL;
-	statp->_u._ext.nscount = 0;
-	for (n = 0; n < MAXNS; n++)
-	    statp->_u._ext.nsaddrs[n] = NULL;
+  statp->nscount = 0;
+  statp->defdname[0] = '\0';
+  statp->ndots = 1;
+  statp->pfcode = 0;
+  statp->_vcsock = -1;
+  statp->_flags = 0;
+  statp->__glibc_unused_qhook = NULL;
+  statp->__glibc_unused_rhook = NULL;
+  statp->_u._ext.nscount = 0;
+  for (int n = 0; n < MAXNS; n++)
+    statp->_u._ext.nsaddrs[n] = NULL;
 
-	/* Allow user to override the local domain definition */
-	if ((cp = getenv("LOCALDOMAIN")) != NULL) {
-		(void)strncpy(statp->defdname, cp, sizeof(statp->defdname) - 1);
-		statp->defdname[sizeof(statp->defdname) - 1] = '\0';
-		haveenv++;
+  /* Allow user to override the local domain definition.  */
+  if ((cp = getenv ("LOCALDOMAIN")) != NULL)
+    {
+      strncpy (statp->defdname, cp, sizeof (statp->defdname) - 1);
+      statp->defdname[sizeof (statp->defdname) - 1] = '\0';
+      haveenv = true;
 
-		/*
-		 * Set search list to be blank-separated strings
-		 * from rest of env value.  Permits users of LOCALDOMAIN
-		 * to still have a search list, and anyone to set the
-		 * one that they want to use as an individual (even more
-		 * important now that the rfc1535 stuff restricts searches)
-		 */
-		cp = statp->defdname;
-		pp = statp->dnsrch;
-		*pp++ = cp;
-		for (n = 0; *cp && pp < statp->dnsrch + MAXDNSRCH; cp++) {
-			if (*cp == '\n')	/* silly backwards compat */
-				break;
-			else if (*cp == ' ' || *cp == '\t') {
-				*cp = 0;
-				n = 1;
-			} else if (n) {
-				*pp++ = cp;
-				n = 0;
-				havesearch = 1;
-			}
-		}
-		/* null terminate last domain if there are excess */
-		while (*cp != '\0' && *cp != ' ' && *cp != '\t' && *cp != '\n')
-			cp++;
-		*cp = '\0';
-		*pp++ = 0;
-	}
+      /* Set search list to be blank-separated strings from rest of
+         env value.  Permits users of LOCALDOMAIN to still have a
+         search list, and anyone to set the one that they want to use
+         as an individual (even more important now that the rfc1535
+         stuff restricts searches).  */
+      cp = statp->defdname;
+      pp = statp->dnsrch;
+      *pp++ = cp;
+      for (int n = 0; *cp && pp < statp->dnsrch + MAXDNSRCH; cp++)
+        {
+          if (*cp == '\n')
+            break;
+          else if (*cp == ' ' || *cp == '\t')
+            {
+              *cp = 0;
+              n = 1;
+            }
+          else if (n > 0)
+            {
+              *pp++ = cp;
+              n = 0;
+              havesearch = true;
+            }
+        }
+      /* Null terminate last domain if there are excess.  */
+      while (*cp != '\0' && *cp != ' ' && *cp != '\t' && *cp != '\n')
+        cp++;
+      *cp = '\0';
+      *pp++ = 0;
+    }
 
-#define	MATCH(line, name) \
-	(!strncmp(line, name, sizeof(name) - 1) && \
-	(line[sizeof(name) - 1] == ' ' || \
-	 line[sizeof(name) - 1] == '\t'))
+#define MATCH(line, name)                       \
+  (!strncmp (line, name, sizeof (name) - 1)     \
+   && (line[sizeof (name) - 1] == ' '           \
+       || line[sizeof (name) - 1] == '\t'))
 
-	if ((fp = fopen(_PATH_RESCONF, "rce")) != NULL) {
-	    /* No threads use this stream.  */
-	    __fsetlocking (fp, FSETLOCKING_BYCALLER);
-	    /* read the config file */
-	    while (__fgets_unlocked(buf, sizeof(buf), fp) != NULL) {
-		/* skip comments */
-		if (*buf == ';' || *buf == '#')
-			continue;
-		/* read default domain name */
-		if (MATCH(buf, "domain")) {
-		    if (haveenv)	/* skip if have from environ */
-			    continue;
-		    cp = buf + sizeof("domain") - 1;
-		    while (*cp == ' ' || *cp == '\t')
-			    cp++;
-		    if ((*cp == '\0') || (*cp == '\n'))
-			    continue;
-		    strncpy(statp->defdname, cp, sizeof(statp->defdname) - 1);
-		    statp->defdname[sizeof(statp->defdname) - 1] = '\0';
-		    if ((cp = strpbrk(statp->defdname, " \t\n")) != NULL)
-			    *cp = '\0';
-		    havesearch = 0;
-		    continue;
-		}
-		/* set search list */
-		if (MATCH(buf, "search")) {
-		    if (haveenv)	/* skip if have from environ */
-			    continue;
-		    cp = buf + sizeof("search") - 1;
-		    while (*cp == ' ' || *cp == '\t')
-			    cp++;
-		    if ((*cp == '\0') || (*cp == '\n'))
-			    continue;
-		    strncpy(statp->defdname, cp, sizeof(statp->defdname) - 1);
-		    statp->defdname[sizeof(statp->defdname) - 1] = '\0';
-		    if ((cp = strchr(statp->defdname, '\n')) != NULL)
-			    *cp = '\0';
-		    /*
-		     * Set search list to be blank-separated strings
-		     * on rest of line.
-		     */
-		    cp = statp->defdname;
-		    pp = statp->dnsrch;
-		    *pp++ = cp;
-		    for (n = 0; *cp && pp < statp->dnsrch + MAXDNSRCH; cp++) {
-			    if (*cp == ' ' || *cp == '\t') {
-				    *cp = 0;
-				    n = 1;
-			    } else if (n) {
-				    *pp++ = cp;
-				    n = 0;
-			    }
-		    }
-		    /* null terminate last domain if there are excess */
-		    while (*cp != '\0' && *cp != ' ' && *cp != '\t')
-			    cp++;
-		    *cp = '\0';
-		    *pp++ = 0;
-		    havesearch = 1;
-		    continue;
-		}
-		/* read nameservers to query */
-		if (MATCH(buf, "nameserver") && nserv < MAXNS) {
-		    struct in_addr a;
+  FILE *fp = fopen (_PATH_RESCONF, "rce");
+  if (fp != NULL)
+    {
+      /* No threads use this stream.  */
+      __fsetlocking (fp, FSETLOCKING_BYCALLER);
+      /* Read the config file.  */
+      while (__fgets_unlocked (buf, sizeof (buf), fp) != NULL)
+        {
+          /* Skip comments.  */
+          if (*buf == ';' || *buf == '#')
+            continue;
+          /* Read default domain name.  */
+          if (MATCH (buf, "domain"))
+            {
+              if (haveenv)
+                /* LOCALDOMAIN overrides the configuration file.  */
+                continue;
+              cp = buf + sizeof ("domain") - 1;
+              while (*cp == ' ' || *cp == '\t')
+                cp++;
+              if ((*cp == '\0') || (*cp == '\n'))
+                continue;
+              strncpy (statp->defdname, cp, sizeof (statp->defdname) - 1);
+              statp->defdname[sizeof (statp->defdname) - 1] = '\0';
+              if ((cp = strpbrk (statp->defdname, " \t\n")) != NULL)
+                *cp = '\0';
+              havesearch = false;
+              continue;
+            }
+          /* Set search list.  */
+          if (MATCH (buf, "search"))
+            {
+              if (haveenv)
+                /* LOCALDOMAIN overrides the configuration file.  */
+                continue;
+              cp = buf + sizeof ("search") - 1;
+              while (*cp == ' ' || *cp == '\t')
+                cp++;
+              if ((*cp == '\0') || (*cp == '\n'))
+                continue;
+              strncpy (statp->defdname, cp, sizeof (statp->defdname) - 1);
+              statp->defdname[sizeof (statp->defdname) - 1] = '\0';
+              if ((cp = strchr (statp->defdname, '\n')) != NULL)
+                *cp = '\0';
+              /* Set search list to be blank-separated strings on rest
+                 of line.  */
+              cp = statp->defdname;
+              pp = statp->dnsrch;
+              *pp++ = cp;
+              for (int n = 0; *cp && pp < statp->dnsrch + MAXDNSRCH; cp++)
+                {
+                  if (*cp == ' ' || *cp == '\t')
+                    {
+                      *cp = 0;
+                      n = 1;
+                    }
+                  else if (n)
+                    {
+                      *pp++ = cp;
+                      n = 0;
+                    }
+                }
+              /* Null terminate last domain if there are excess.  */
+              while (*cp != '\0' && *cp != ' ' && *cp != '\t')
+                cp++;
+              *cp = '\0';
+              *pp++ = 0;
+              havesearch = true;
+              continue;
+            }
+          /* Read nameservers to query.  */
+          if (MATCH (buf, "nameserver") && nserv < MAXNS)
+            {
+              struct in_addr a;
 
-		    cp = buf + sizeof("nameserver") - 1;
-		    while (*cp == ' ' || *cp == '\t')
-			cp++;
-		    if ((*cp != '\0') && (*cp != '\n')
-			&& __inet_aton(cp, &a)) {
-			statp->nsaddr_list[nserv].sin_addr = a;
-			statp->nsaddr_list[nserv].sin_family = AF_INET;
-			statp->nsaddr_list[nserv].sin_port =
-				htons(NAMESERVER_PORT);
-			nserv++;
-		    } else {
-			struct in6_addr a6;
-			char *el;
+              cp = buf + sizeof ("nameserver") - 1;
+              while (*cp == ' ' || *cp == '\t')
+                cp++;
+              if ((*cp != '\0') && (*cp != '\n') && __inet_aton (cp, &a))
+                {
+                  statp->nsaddr_list[nserv].sin_addr = a;
+                  statp->nsaddr_list[nserv].sin_family = AF_INET;
+                  statp->nsaddr_list[nserv].sin_port = htons (NAMESERVER_PORT);
+                  nserv++;
+                }
+              else
+                {
+                  struct in6_addr a6;
+                  char *el;
 
-			if ((el = strpbrk(cp, " \t\n")) != NULL)
-			    *el = '\0';
-			if ((el = strchr(cp, SCOPE_DELIMITER)) != NULL)
-			    *el = '\0';
-			if ((*cp != '\0') &&
-			    (__inet_pton(AF_INET6, cp, &a6) > 0)) {
-			    struct sockaddr_in6 *sa6;
+                  if ((el = strpbrk (cp, " \t\n")) != NULL)
+                    *el = '\0';
+                  if ((el = strchr (cp, SCOPE_DELIMITER)) != NULL)
+                    *el = '\0';
+                  if ((*cp != '\0') && (__inet_pton (AF_INET6, cp, &a6) > 0))
+                    {
+                      struct sockaddr_in6 *sa6;
 
-			    sa6 = malloc(sizeof(*sa6));
-			    if (sa6 != NULL) {
-				sa6->sin6_family = AF_INET6;
-				sa6->sin6_port = htons(NAMESERVER_PORT);
-				sa6->sin6_flowinfo = 0;
-				sa6->sin6_addr = a6;
+                      sa6 = malloc (sizeof (*sa6));
+                      if (sa6 != NULL)
+                        {
+                          sa6->sin6_family = AF_INET6;
+                          sa6->sin6_port = htons (NAMESERVER_PORT);
+                          sa6->sin6_flowinfo = 0;
+                          sa6->sin6_addr = a6;
 
-				sa6->sin6_scope_id = 0;
-				if (__glibc_likely (el != NULL)) {
-				  /* Ignore errors, for backwards
-				     compatibility.  */
-				  (void) __inet6_scopeid_pton
-				    (&a6, el + 1, &sa6->sin6_scope_id);
-				}
+                          sa6->sin6_scope_id = 0;
+                          if (__glibc_likely (el != NULL))
+                            /* Ignore errors, for backwards
+                               compatibility.  */
+                            __inet6_scopeid_pton
+                              (&a6, el + 1, &sa6->sin6_scope_id);
 
-				statp->nsaddr_list[nserv].sin_family = 0;
-				statp->_u._ext.nsaddrs[nserv] = sa6;
-				statp->_u._ext.nssocks[nserv] = -1;
-				have_serv6 = 1;
-				nserv++;
-			    }
-			}
-		    }
-		    continue;
-		}
-		if (MATCH(buf, "sortlist")) {
-		    struct in_addr a;
+                          statp->nsaddr_list[nserv].sin_family = 0;
+                          statp->_u._ext.nsaddrs[nserv] = sa6;
+                          statp->_u._ext.nssocks[nserv] = -1;
+                          have_serv6 = true;
+                          nserv++;
+                        }
+                    }
+                }
+              continue;
+            }
+          if (MATCH (buf, "sortlist"))
+            {
+              struct in_addr a;
 
-		    cp = buf + sizeof("sortlist") - 1;
-		    while (nsort < MAXRESOLVSORT) {
-			while (*cp == ' ' || *cp == '\t')
-			    cp++;
-			if (*cp == '\0' || *cp == '\n' || *cp == ';')
-			    break;
-			net = cp;
-			while (*cp && !is_sort_mask (*cp) && *cp != ';' &&
-			       isascii(*cp) && !isspace(*cp))
-				cp++;
-			n = *cp;
-			*cp = 0;
-			if (__inet_aton(net, &a)) {
-			    statp->sort_list[nsort].addr = a;
-			    if (is_sort_mask (n)) {
-				*cp++ = n;
-				net = cp;
-				while (*cp && *cp != ';' &&
-					isascii(*cp) && !isspace(*cp))
-				    cp++;
-				n = *cp;
-				*cp = 0;
-				if (__inet_aton(net, &a)) {
-				    statp->sort_list[nsort].mask = a.s_addr;
-				} else {
-				    statp->sort_list[nsort].mask =
-					net_mask(statp->sort_list[nsort].addr);
-				}
-			    } else {
-				statp->sort_list[nsort].mask =
-				    net_mask(statp->sort_list[nsort].addr);
-			    }
-			    nsort++;
-			}
-			*cp = n;
-		    }
-		    continue;
-		}
-		if (MATCH(buf, "options")) {
-		    res_setoptions(statp, buf + sizeof("options") - 1, "conf");
-		    continue;
-		}
-	    }
-	    statp->nscount = nserv;
-	    if (have_serv6) {
-		/* We try IPv6 servers again.  */
-		statp->ipv6_unavail = false;
-	    }
-	    statp->nsort = nsort;
-	    (void) fclose(fp);
-	}
-	if (__glibc_unlikely (statp->nscount == 0)) {
-	    statp->nsaddr.sin_addr = __inet_makeaddr(IN_LOOPBACKNET, 1);
-	    statp->nsaddr.sin_family = AF_INET;
-	    statp->nsaddr.sin_port = htons(NAMESERVER_PORT);
-	    statp->nscount = 1;
-	}
-	if (statp->defdname[0] == 0 &&
-	    __gethostname(buf, sizeof(statp->defdname) - 1) == 0 &&
-	    (cp = strchr(buf, '.')) != NULL)
-		strcpy(statp->defdname, cp + 1);
+              cp = buf + sizeof ("sortlist") - 1;
+              while (nsort < MAXRESOLVSORT)
+                {
+                  while (*cp == ' ' || *cp == '\t')
+                    cp++;
+                  if (*cp == '\0' || *cp == '\n' || *cp == ';')
+                    break;
+                  net = cp;
+                  while (*cp && !is_sort_mask (*cp) && *cp != ';'
+                         && isascii (*cp) && !isspace (*cp))
+                    cp++;
+                  char separator = *cp;
+                  *cp = 0;
+                  if (__inet_aton (net, &a))
+                    {
+                      statp->sort_list[nsort].addr = a;
+                      if (is_sort_mask (separator))
+                        {
+                          *cp++ = separator;
+                          net = cp;
+                          while (*cp && *cp != ';'
+                                 && isascii (*cp) && !isspace (*cp))
+                            cp++;
+                          separator = *cp;
+                          *cp = 0;
+                          if (__inet_aton (net, &a))
+                            statp->sort_list[nsort].mask = a.s_addr;
+                          else
+                            statp->sort_list[nsort].mask
+                              = net_mask (statp->sort_list[nsort].addr);
+                        }
+                      else
+                        statp->sort_list[nsort].mask
+                          = net_mask (statp->sort_list[nsort].addr);
+                      nsort++;
+                    }
+                  *cp = separator;
+                }
+              continue;
+            }
+          if (MATCH (buf, "options"))
+            {
+              res_setoptions (statp, buf + sizeof ("options") - 1, "conf");
+              continue;
+            }
+        }
+      statp->nscount = nserv;
+      if (have_serv6)
+        /* We try IPv6 servers again.  */
+        statp->ipv6_unavail = false;
+      statp->nsort = nsort;
+      fclose (fp);
+    }
+  if (__glibc_unlikely (statp->nscount == 0))
+    {
+      statp->nsaddr.sin_addr = __inet_makeaddr (IN_LOOPBACKNET, 1);
+      statp->nsaddr.sin_family = AF_INET;
+      statp->nsaddr.sin_port = htons (NAMESERVER_PORT);
+      statp->nscount = 1;
+    }
+  if (statp->defdname[0] == 0
+      && __gethostname (buf, sizeof (statp->defdname) - 1) == 0
+      && (cp = strchr (buf, '.')) != NULL)
+    strcpy (statp->defdname, cp + 1);
 
-	/* find components of local domain that might be searched */
-	if (havesearch == 0) {
-		pp = statp->dnsrch;
-		*pp++ = statp->defdname;
-		*pp = NULL;
+  /* Find components of local domain that might be searched.  */
+  if (!havesearch)
+    {
+      pp = statp->dnsrch;
+      *pp++ = statp->defdname;
+      *pp = NULL;
 
-	}
+    }
 
-	if ((cp = getenv("RES_OPTIONS")) != NULL)
-		res_setoptions(statp, cp, "env");
-	statp->options |= RES_INIT;
-	return (0);
+  if ((cp = getenv ("RES_OPTIONS")) != NULL)
+    res_setoptions (statp, cp, "env");
+  statp->options |= RES_INIT;
+  return 0;
 }
 
 static void
-internal_function
-res_setoptions(res_state statp, const char *options, const char *source) {
-	const char *cp = options;
-	int i;
+res_setoptions (res_state statp, const char *options, const char *source)
+{
+  const char *cp = options;
 
-	while (*cp) {
-		/* skip leading and inner runs of spaces */
-		while (*cp == ' ' || *cp == '\t')
-			cp++;
-		/* search for and process individual options */
-		if (!strncmp(cp, "ndots:", sizeof("ndots:") - 1)) {
-			i = atoi(cp + sizeof("ndots:") - 1);
-			if (i <= RES_MAXNDOTS)
-				statp->ndots = i;
-			else
-				statp->ndots = RES_MAXNDOTS;
-		} else if (!strncmp(cp, "timeout:", sizeof("timeout:") - 1)) {
-			i = atoi(cp + sizeof("timeout:") - 1);
-			if (i <= RES_MAXRETRANS)
-				statp->retrans = i;
-			else
-				statp->retrans = RES_MAXRETRANS;
-		} else if (!strncmp(cp, "attempts:", sizeof("attempts:") - 1)){
-			i = atoi(cp + sizeof("attempts:") - 1);
-			if (i <= RES_MAXRETRY)
-				statp->retry = i;
-			else
-				statp->retry = RES_MAXRETRY;
-		} else {
-		  static const struct
-		  {
-		    char str[22];
-		    uint8_t len;
-		    uint8_t clear;
-		    unsigned long int flag;
-		  } options[] = {
+  while (*cp)
+    {
+      /* Skip leading and inner runs of spaces.  */
+      while (*cp == ' ' || *cp == '\t')
+        cp++;
+      /* Search for and process individual options.  */
+      if (!strncmp (cp, "ndots:", sizeof ("ndots:") - 1))
+        {
+          int i = atoi (cp + sizeof ("ndots:") - 1);
+          if (i <= RES_MAXNDOTS)
+            statp->ndots = i;
+          else
+            statp->ndots = RES_MAXNDOTS;
+        }
+      else if (!strncmp (cp, "timeout:", sizeof ("timeout:") - 1))
+        {
+          int i = atoi (cp + sizeof ("timeout:") - 1);
+          if (i <= RES_MAXRETRANS)
+            statp->retrans = i;
+          else
+            statp->retrans = RES_MAXRETRANS;
+        }
+      else if (!strncmp (cp, "attempts:", sizeof ("attempts:") - 1))
+        {
+          int i = atoi (cp + sizeof ("attempts:") - 1);
+          if (i <= RES_MAXRETRY)
+            statp->retry = i;
+          else
+            statp->retry = RES_MAXRETRY;
+        }
+      else
+        {
+          static const struct
+          {
+            char str[22];
+            uint8_t len;
+            uint8_t clear;
+            unsigned long int flag;
+          } options[] = {
 #define STRnLEN(str) str, sizeof (str) - 1
-		    { STRnLEN ("inet6"), 0, DEPRECATED_RES_USE_INET6 },
-		    { STRnLEN ("rotate"), 0, RES_ROTATE },
-		    { STRnLEN ("edns0"), 0, RES_USE_EDNS0 },
-		    { STRnLEN ("single-request-reopen"), 0, RES_SNGLKUPREOP },
-		    { STRnLEN ("single-request"), 0, RES_SNGLKUP },
-		    { STRnLEN ("no_tld_query"), 0, RES_NOTLDQUERY },
-		    { STRnLEN ("no-tld-query"), 0, RES_NOTLDQUERY },
-		    { STRnLEN ("use-vc"), 0, RES_USEVC }
-		  };
+            { STRnLEN ("inet6"), 0, DEPRECATED_RES_USE_INET6 },
+            { STRnLEN ("rotate"), 0, RES_ROTATE },
+            { STRnLEN ("edns0"), 0, RES_USE_EDNS0 },
+            { STRnLEN ("single-request-reopen"), 0, RES_SNGLKUPREOP },
+            { STRnLEN ("single-request"), 0, RES_SNGLKUP },
+            { STRnLEN ("no_tld_query"), 0, RES_NOTLDQUERY },
+            { STRnLEN ("no-tld-query"), 0, RES_NOTLDQUERY },
+            { STRnLEN ("use-vc"), 0, RES_USEVC }
+          };
 #define noptions (sizeof (options) / sizeof (options[0]))
-		  int i;
-		  for (i = 0; i < noptions; ++i)
-		    if (strncmp (cp, options[i].str, options[i].len) == 0)
-		      {
-			if (options[i].clear)
-			  statp->options &= options[i].flag;
-			else
-			  statp->options |= options[i].flag;
-			break;
-		      }
-		  if (i == noptions) {
-		    /* XXX - print a warning here? */
-		  }
-		}
-		/* skip to next run of spaces */
-		while (*cp && *cp != ' ' && *cp != '\t')
-			cp++;
-	}
+          for (int i = 0; i < noptions; ++i)
+            if (strncmp (cp, options[i].str, options[i].len) == 0)
+              {
+                if (options[i].clear)
+                  statp->options &= options[i].flag;
+                else
+                  statp->options |= options[i].flag;
+                break;
+              }
+        }
+      /* Skip to next run of spaces.  */
+      while (*cp && *cp != ' ' && *cp != '\t')
+        cp++;
+    }
 }
 
-/* XXX - should really support CIDR which means explicit masks always. */
-/* XXX - should really use system's version of this */
-static u_int32_t
+static uint32_t
 net_mask (struct in_addr in)
 {
-	u_int32_t i = ntohl(in.s_addr);
+  uint32_t i = ntohl (in.s_addr);
 
-	if (IN_CLASSA(i))
-		return (htonl(IN_CLASSA_NET));
-	else if (IN_CLASSB(i))
-		return (htonl(IN_CLASSB_NET));
-	return (htonl(IN_CLASSC_NET));
+  if (IN_CLASSA (i))
+    return htonl (IN_CLASSA_NET);
+  else if (IN_CLASSB (i))
+    return htonl (IN_CLASSB_NET);
+  return htonl (IN_CLASSC_NET);
 }

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

commit 94f094f22b50a20de9042cb1e78c7299992a91c9
Author: Florian Weimer <fweimer@redhat.com>
Date:   Mon Jun 19 13:19:00 2017 +0200

    resolv: Introduce is_sort_mask and call it from res_vinit

diff --git a/ChangeLog b/ChangeLog
index 0e2f141..da00dbd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2017-06-19  Florian Weimer  <fweimer@redhat.com>
 
+	* resolv/res_init.c (sort_mask_chars, ISSORTMASK): Remove.
+	(is_sort_mask): New function.
+	(__res_vinit): Use it.
+
+2017-06-19  Florian Weimer  <fweimer@redhat.com>
+
 	* resolv/res_init.c (res_setoptions): Remove DEBUG preprocessor
 	conditionals.
 
diff --git a/resolv/res_init.c b/resolv/res_init.c
index eb24fca..eb8e308 100644
--- a/resolv/res_init.c
+++ b/resolv/res_init.c
@@ -85,9 +85,6 @@
 
 static void res_setoptions (res_state, const char *, const char *)
      internal_function;
-
-static const char sort_mask_chars[] = "/&";
-#define ISSORTMASK(ch) (strchr(sort_mask_chars, ch) != NULL)
 static u_int32_t net_mask (struct in_addr) __THROW;
 
 unsigned long long int __res_initstamp attribute_hidden;
@@ -109,6 +106,14 @@ res_ninit(res_state statp) {
 }
 libc_hidden_def (__res_ninit)
 
+/* Return true if CH separates the netmask in the "sortlist"
+   directive.  */
+static inline bool
+is_sort_mask (char ch)
+{
+  return ch == '/' || ch == '&';
+}
+
 /* This function has to be reachable by res_data.c but not publically. */
 int
 __res_vinit(res_state statp, int preinit) {
@@ -305,14 +310,14 @@ __res_vinit(res_state statp, int preinit) {
 			if (*cp == '\0' || *cp == '\n' || *cp == ';')
 			    break;
 			net = cp;
-			while (*cp && !ISSORTMASK(*cp) && *cp != ';' &&
+			while (*cp && !is_sort_mask (*cp) && *cp != ';' &&
 			       isascii(*cp) && !isspace(*cp))
 				cp++;
 			n = *cp;
 			*cp = 0;
 			if (__inet_aton(net, &a)) {
 			    statp->sort_list[nsort].addr = a;
-			    if (ISSORTMASK(n)) {
+			    if (is_sort_mask (n)) {
 				*cp++ = n;
 				net = cp;
 				while (*cp && *cp != ';' &&

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

commit e68111fbd63e84b66bd9e03b42721c79230b9b6d
Author: Florian Weimer <fweimer@redhat.com>
Date:   Mon Jun 19 13:18:45 2017 +0200

    resolv: Remove DEBUG preprocessor conditionals from res_setoptions

diff --git a/ChangeLog b/ChangeLog
index 089e949..0e2f141 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2017-06-19  Florian Weimer  <fweimer@redhat.com>
 
+	* resolv/res_init.c (res_setoptions): Remove DEBUG preprocessor
+	conditionals.
+
+2017-06-19  Florian Weimer  <fweimer@redhat.com>
+
 	* resolv/res-close.c: New file.
 	* resolv/res_init.c (__res_iclose, res_nclose)
 	(res_thread_freeres): Remove definitions.
diff --git a/resolv/res_init.c b/resolv/res_init.c
index eb380d3..eb24fca 100644
--- a/resolv/res_init.c
+++ b/resolv/res_init.c
@@ -83,9 +83,6 @@
 #include <sys/types.h>
 #include <inet/net-internal.h>
 
-/* Options.  Should all be left alone. */
-/* #undef DEBUG */
-
 static void res_setoptions (res_state, const char *, const char *)
      internal_function;
 
@@ -383,11 +380,6 @@ res_setoptions(res_state statp, const char *options, const char *source) {
 	const char *cp = options;
 	int i;
 
-#ifdef DEBUG
-	if (statp->options & RES_DEBUG)
-		printf(";; res_setoptions(\"%s\", \"%s\")...\n",
-		       options, source);
-#endif
 	while (*cp) {
 		/* skip leading and inner runs of spaces */
 		while (*cp == ' ' || *cp == '\t')
@@ -399,10 +391,6 @@ res_setoptions(res_state statp, const char *options, const char *source) {
 				statp->ndots = i;
 			else
 				statp->ndots = RES_MAXNDOTS;
-#ifdef DEBUG
-			if (statp->options & RES_DEBUG)
-				printf(";;\tndots=%d\n", statp->ndots);
-#endif
 		} else if (!strncmp(cp, "timeout:", sizeof("timeout:") - 1)) {
 			i = atoi(cp + sizeof("timeout:") - 1);
 			if (i <= RES_MAXRETRANS)
@@ -415,15 +403,6 @@ res_setoptions(res_state statp, const char *options, const char *source) {
 				statp->retry = i;
 			else
 				statp->retry = RES_MAXRETRY;
-		} else if (!strncmp(cp, "debug", sizeof("debug") - 1)) {
-#ifdef DEBUG
-			if (!(statp->options & RES_DEBUG)) {
-				printf(";; res_setoptions(\"%s\", \"%s\")..\n",
-				       options, source);
-				statp->options |= RES_DEBUG;
-			}
-			printf(";;\tdebug\n");
-#endif
 		} else {
 		  static const struct
 		  {

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

commit e4e5b57d23b4ebdbf773fedba91160158f95af94
Author: Florian Weimer <fweimer@redhat.com>
Date:   Mon Jun 19 13:17:49 2017 +0200

    resolv: Move _res deallocation functions to their own file

diff --git a/ChangeLog b/ChangeLog
index 40d2bb4..089e949 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2017-06-19  Florian Weimer  <fweimer@redhat.com>
 
+	* resolv/res-close.c: New file.
+	* resolv/res_init.c (__res_iclose, res_nclose)
+	(res_thread_freeres): Remove definitions.
+	* resolv/Makefile (routines): Add res-close.
+
+2017-06-19  Florian Weimer  <fweimer@redhat.com>
+
 	* resolv/res_randomid.c: New file.
 	* resolv/res_init.c (res_randomid): Remove definition.
 	* resolv/Makefile (routines): Add res_randomid.
diff --git a/resolv/Makefile b/resolv/Makefile
index 980dfb7..a9b355f 100644
--- a/resolv/Makefile
+++ b/resolv/Makefile
@@ -28,7 +28,7 @@ headers	:= resolv.h bits/types/res_state.h \
 	   sys/bitypes.h
 
 routines := herror inet_addr inet_ntop inet_pton nsap_addr res_init \
-	    res_hconf res_libc res-state res_randomid
+	    res_hconf res_libc res-state res_randomid res-close
 
 tests = tst-aton tst-leaks tst-inet_ntop
 xtests = tst-leaks2
diff --git a/resolv/res-close.c b/resolv/res-close.c
new file mode 100644
index 0000000..73f18d1
--- /dev/null
+++ b/resolv/res-close.c
@@ -0,0 +1,137 @@
+/* Deallocation functions for the resolver state.
+   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, 1989, 1993
+ *    The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Portions Copyright (c) 1993 by Digital Equipment Corporation.
+ *
+ * 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, and that
+ * the name of Digital Equipment Corporation not be used in advertising or
+ * publicity pertaining to distribution of the document or software without
+ * specific, written prior permission.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
+ * CORPORATION 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.
+ */
+
+/*
+ * Portions Copyright (c) 1996-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.
+ */
+
+#include <resolv-internal.h>
+#include <not-cancel.h>
+
+/* Close all open sockets.  If FREE_ADDR is true, deallocate any
+   separately allocated name server addresses.  */
+void
+__res_iclose (res_state statp, bool free_addr)
+{
+  if (statp->_vcsock >= 0)
+    {
+      close_not_cancel_no_status (statp->_vcsock);
+      statp->_vcsock = -1;
+      statp->_flags &= ~(RES_F_VC | RES_F_CONN);
+    }
+  for (int ns = 0; ns < statp->nscount; ns++)
+    if (statp->_u._ext.nsaddrs[ns] != NULL)
+      {
+        if (statp->_u._ext.nssocks[ns] != -1)
+          {
+            close_not_cancel_no_status (statp->_u._ext.nssocks[ns]);
+            statp->_u._ext.nssocks[ns] = -1;
+          }
+        if (free_addr)
+          {
+            free (statp->_u._ext.nsaddrs[ns]);
+            statp->_u._ext.nsaddrs[ns] = NULL;
+          }
+      }
+}
+libc_hidden_def (__res_iclose)
+
+void
+res_nclose (res_state statp)
+{
+  __res_iclose (statp, true);
+}
+libc_hidden_def (__res_nclose)
+
+/* This is called when a thread is exiting to free resources held in _res.  */
+static void __attribute__ ((section ("__libc_thread_freeres_fn")))
+res_thread_freeres (void)
+{
+  if (_res.nscount == 0)
+    /* Never called res_ninit.  */
+    return;
+
+  __res_iclose (&_res, true);           /* Close any VC sockets.  */
+
+  /* Make sure we do a full re-initialization the next time.  */
+  _res.options = 0;
+}
+text_set_element (__libc_thread_subfreeres, res_thread_freeres);
+text_set_element (__libc_subfreeres, res_thread_freeres);
diff --git a/resolv/res_init.c b/resolv/res_init.c
index ef2e7c0..eb380d3 100644
--- a/resolv/res_init.c
+++ b/resolv/res_init.c
@@ -83,8 +83,6 @@
 #include <sys/types.h>
 #include <inet/net-internal.h>
 
-#include <not-cancel.h>
-
 /* Options.  Should all be left alone. */
 /* #undef DEBUG */
 
@@ -478,56 +476,3 @@ net_mask (struct in_addr in)
 		return (htonl(IN_CLASSB_NET));
 	return (htonl(IN_CLASSC_NET));
 }
-
-/*
- * This routine is for closing the socket if a virtual circuit is used and
- * the program wants to close it.  This provides support for endhostent()
- * which expects to close the socket.
- *
- * This routine is not expected to be user visible.
- */
-void
-__res_iclose(res_state statp, bool free_addr) {
-	int ns;
-
-	if (statp->_vcsock >= 0) {
-		close_not_cancel_no_status(statp->_vcsock);
-		statp->_vcsock = -1;
-		statp->_flags &= ~(RES_F_VC | RES_F_CONN);
-	}
-	for (ns = 0; ns < statp->nscount; ns++)
-		if (statp->_u._ext.nsaddrs[ns]) {
-			if (statp->_u._ext.nssocks[ns] != -1) {
-				close_not_cancel_no_status(statp->_u._ext.nssocks[ns]);
-				statp->_u._ext.nssocks[ns] = -1;
-			}
-			if (free_addr) {
-				free (statp->_u._ext.nsaddrs[ns]);
-				statp->_u._ext.nsaddrs[ns] = NULL;
-			}
-		}
-}
-libc_hidden_def (__res_iclose)
-
-void
-res_nclose(res_state statp)
-{
-  __res_iclose (statp, true);
-}
-libc_hidden_def (__res_nclose)
-
-/* This is called when a thread is exiting to free resources held in _res.  */
-static void __attribute__ ((section ("__libc_thread_freeres_fn")))
-res_thread_freeres (void)
-{
-  if (_res.nscount == 0)
-    /* Never called res_ninit.  */
-    return;
-
-  __res_iclose (&_res, true);		/* Close any VC sockets.  */
-
-  /* Make sure we do a full re-initialization the next time.  */
-  _res.options = 0;
-}
-text_set_element (__libc_thread_subfreeres, res_thread_freeres);
-text_set_element (__libc_subfreeres, res_thread_freeres);

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

commit 26bf5a1029434c98db85947eed11ce3090b2f5db
Author: Florian Weimer <fweimer@redhat.com>
Date:   Mon Jun 19 13:17:03 2017 +0200

    resolv: Move res_randomid to its own file

diff --git a/ChangeLog b/ChangeLog
index 388fc42..40d2bb4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2017-06-19  Florian Weimer  <fweimer@redhat.com>
 
+	* resolv/res_randomid.c: New file.
+	* resolv/res_init.c (res_randomid): Remove definition.
+	* resolv/Makefile (routines): Add res_randomid.
+
+2017-06-19  Florian Weimer  <fweimer@redhat.com>
+
 	* include/resolv.h (__res_vinit): Declare as hidden.
 	* resolv/res_init.c (res_ninit): Remove __res_vinit declaration.
 	* resolv/res_libc.c (res_init): Likewise.
diff --git a/resolv/Makefile b/resolv/Makefile
index dc597ca..980dfb7 100644
--- a/resolv/Makefile
+++ b/resolv/Makefile
@@ -28,7 +28,7 @@ headers	:= resolv.h bits/types/res_state.h \
 	   sys/bitypes.h
 
 routines := herror inet_addr inet_ntop inet_pton nsap_addr res_init \
-	    res_hconf res_libc res-state
+	    res_hconf res_libc res-state res_randomid
 
 tests = tst-aton tst-leaks tst-inet_ntop
 xtests = tst-leaks2
diff --git a/resolv/res_init.c b/resolv/res_init.c
index 57223b4..ef2e7c0 100644
--- a/resolv/res_init.c
+++ b/resolv/res_init.c
@@ -479,13 +479,6 @@ net_mask (struct in_addr in)
 	return (htonl(IN_CLASSC_NET));
 }
 
-u_int
-res_randomid(void) {
-	return 0xffff & __getpid();
-}
-libc_hidden_def (__res_randomid)
-
-
 /*
  * This routine is for closing the socket if a virtual circuit is used and
  * the program wants to close it.  This provides support for endhostent()
diff --git a/resolv/res_randomid.c b/resolv/res_randomid.c
new file mode 100644
index 0000000..e0dbe4c
--- /dev/null
+++ b/resolv/res_randomid.c
@@ -0,0 +1,92 @@
+/* Legacy libresolv random number generator.
+   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, 1989, 1993
+ *    The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Portions Copyright (c) 1993 by Digital Equipment Corporation.
+ *
+ * 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, and that
+ * the name of Digital Equipment Corporation not be used in advertising or
+ * publicity pertaining to distribution of the document or software without
+ * specific, written prior permission.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
+ * CORPORATION 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.
+ */
+
+/*
+ * Portions Copyright (c) 1996-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.
+ */
+
+#include <resolv.h>
+#include <unistd.h>
+
+unsigned int
+res_randomid (void) {
+  return 0xffff & __getpid ();
+}
+libc_hidden_def (__res_randomid)

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

commit ca3d65ff69d5187cb4d6b7f81d414427c7007e22
Author: Florian Weimer <fweimer@redhat.com>
Date:   Mon Jun 19 13:15:11 2017 +0200

    resolv: Make __res_vinit hidden
    
    And remove unnecessary separate declarations.

diff --git a/ChangeLog b/ChangeLog
index 9a82a2b..388fc42 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-06-19  Florian Weimer  <fweimer@redhat.com>
+
+	* include/resolv.h (__res_vinit): Declare as hidden.
+	* resolv/res_init.c (res_ninit): Remove __res_vinit declaration.
+	* resolv/res_libc.c (res_init): Likewise.
+
 2017-06-19  Joseph Myers  <joseph@codesourcery.com>
 
 	[BZ #21457]
diff --git a/include/resolv.h b/include/resolv.h
index e8f477c..37e4047 100644
--- a/include/resolv.h
+++ b/include/resolv.h
@@ -23,7 +23,7 @@ extern __thread struct __res_state *__resp attribute_tls_model_ie;
 # define _res (*__resp)
 
 /* Now define the internal interfaces.  */
-extern int __res_vinit (res_state, int);
+extern int __res_vinit (res_state, int) attribute_hidden;
 extern int __res_maybe_init (res_state, int);
 extern void _sethtent (int);
 extern struct hostent *_gethtent (void);
diff --git a/resolv/res_init.c b/resolv/res_init.c
index 23676e9..57223b4 100644
--- a/resolv/res_init.c
+++ b/resolv/res_init.c
@@ -110,8 +110,6 @@ unsigned long long int __res_initstamp attribute_hidden;
  */
 int
 res_ninit(res_state statp) {
-	extern int __res_vinit(res_state, int);
-
 	return (__res_vinit(statp, 0));
 }
 libc_hidden_def (__res_ninit)
diff --git a/resolv/res_libc.c b/resolv/res_libc.c
index c8f158d..3bf3887 100644
--- a/resolv/res_libc.c
+++ b/resolv/res_libc.c
@@ -41,8 +41,6 @@ __libc_lock_define_initialized (static, lock);
 
 int
 res_init(void) {
-	extern int __res_vinit(res_state, int);
-
 	/*
 	 * These three fields used to be statically initialized.  This made
 	 * it hard to use this code in a shared library.  It is necessary,

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

Summary of changes:
 ChangeLog                              |   52 ++
 include/resolv.h                       |    2 +-
 resolv/Makefile                        |    2 +-
 resolv/nss_dns/dns-host.c              |   18 +-
 resolv/nss_dns/dns-network.c           |   12 +-
 resolv/{inet_addr.c => res-close.c}    |  174 +++----
 resolv/res_init.c                      |  880 ++++++++++++++++----------------
 resolv/res_libc.c                      |    2 -
 resolv/{inet_addr.c => res_randomid.c} |  141 +-----
 9 files changed, 611 insertions(+), 672 deletions(-)
 copy resolv/{inet_addr.c => res-close.c} (59%)
 copy resolv/{inet_addr.c => res_randomid.c} (59%)


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]