]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
[BZ #4814]
authorUlrich Drepper <drepper@redhat.com>
Wed, 22 Aug 2007 03:14:29 +0000 (03:14 +0000)
committerUlrich Drepper <drepper@redhat.com>
Wed, 22 Aug 2007 03:14:29 +0000 (03:14 +0000)
* resolv/res_hconf.c: Prepare for compiling outside libc.
* nscd/res_hconf.c: New file.
* nscd/Makefile (nscd-modules): Add res_hconf.  Add rules to build
the new file.
* nscd/gethstbynm2_r.c (NEED__RES_HCONF): Define.
* nscd/gethstbyad_r.c (NEED__RES_HCONF): Likewise.

ChangeLog
nscd/Makefile
nscd/gethstbyad_r.c
nscd/gethstbynm2_r.c
nscd/hstcache.c
nscd/res_hconf.c [new file with mode: 0644]
resolv/res_hconf.c

index de0bd4e62c62d2830014f6b556e49264831371c6..19dae1f6b5cd51b648ccdb5510ad3737a2d77e9a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2007-08-21  Ulrich Drepper  <drepper@redhat.com>
 
+       [BZ #4814]
+       * resolv/res_hconf.c: Prepare for compiling outside libc.
+       * nscd/res_hconf.c: New file.
+       * nscd/Makefile (nscd-modules): Add res_hconf.  Add rules to build
+       the new file.
+       * nscd/gethstbynm2_r.c (NEED__RES_HCONF): Define.
+       * nscd/gethstbyad_r.c (NEED__RES_HCONF): Likewise.
+
        * nscd/hstcache.c (cache_addhst): Minimal optimization.
 
        [BZ #4925]
index ef3ce184f91bcf617285f83a644dc8c798d1188d..ecd8c89998083a0089b9f0cdffe96d1645dd23ac 100644 (file)
@@ -35,7 +35,7 @@ nscd-modules := nscd connections pwdcache getpwnam_r getpwuid_r grpcache \
                getgrnam_r getgrgid_r hstcache gethstbyad_r gethstbynm2_r \
                getsrvbynm_r getsrvbypt_r servicescache \
                dbg_log nscd_conf nscd_stat cache mem nscd_setup_thread \
-               xmalloc xstrdup aicache initgrcache gai
+               xmalloc xstrdup aicache initgrcache gai res_hconf
 
 ifeq ($(have-thread-library),yes)
 
@@ -122,6 +122,7 @@ CFLAGS-gai.c += $(nscd-cflags)
 CFLAGS-servicescache.c += $(nscd-cflags)
 CFLAGS-getsrvbynm_r.c += $(nscd-cflags)
 CFLAGS-getsrvbypt_r.c += $(nscd-cflags)
+CFLAGS-res_hconf.c += $(nscd-cflags)
 
 ifeq (yesyes,$(have-fpie)$(build-shared))
 relro-LDFLAGS += -Wl,-z,now
index e0cd82c32b756783e1659c2c2426a17523b55c0d..e2e8dfe2ccbf3e5da1ca9b38a12ec6d545ce00f9 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996,1997,1998,1999,2000,2005 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2000, 2005, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -26,5 +26,6 @@
 #define ADD_VARIABLES  addr, len, type
 #define NEED_H_ERRNO   1
 #define NEED__RES      1
+#define NEED__RES_HCONF 1
 
 #include "../nss/getXXbyYY_r.c"
index abe992cc1c57c320b80a8b7867d7f2664210288b..85e95d4a630b12f41817672772b0634b9932cf9a 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 2000, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1996-1998, 2000, 2005, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -30,6 +30,7 @@
 #define ADD_PARAMS     const char *name, int af
 #define ADD_VARIABLES  name, af
 #define NEED_H_ERRNO   1
+#define NEED__RES_HCONF 1
 
 #define HANDLE_DIGITS_DOTS     1
 #define HAVE_LOOKUP_BUFFER     1
index 65adf318c5efa49557fa7a063669b756e00a6f4a..74de8f656725a1b80ce125b90c57db3cef6ea6b4 100644 (file)
@@ -196,7 +196,7 @@ cache_addhst (struct database_dyn *db, int fd, request_header *req,
 
       /* Determine the number of addresses.  */
       h_addr_list_cnt = 0;
-      for (cnt = 0; hst->h_addr_list[cnt]; ++cnt)
+      while (hst->h_addr_list[h_addr_list_cnt] != NULL)
        ++h_addr_list_cnt;
 
       if (h_addr_list_cnt == 0)
diff --git a/nscd/res_hconf.c b/nscd/res_hconf.c
new file mode 100644 (file)
index 0000000..14b0e30
--- /dev/null
@@ -0,0 +1,13 @@
+/* Add the include here so that we can redefine __fxprintf.  */
+#include <stdio.h>
+
+/* Rename symbols for protected names used in libc itself.  */
+#define __ioctl ioctl
+#define __socket socket
+#define __strchrnul strchrnul
+#define __strncasecmp strncasecmp
+
+#define __fxprintf(args...) /* ignore */
+
+
+#include "../resolv/res_hconf.c"
index f45888933f21d0b200c883a7cce0585d5e8bd140..c53b809ef7546572c343a90ac2bbdd27cd7a83a9 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995-2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995-2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by David Mosberger (davidm@azstarnet.com).
 
@@ -361,6 +361,7 @@ _res_hconf_init (void)
 }
 
 
+#ifndef NOT_IN_libc
 /* List of known interfaces.  */
 libc_freeres_ptr (
 static struct netaddr
@@ -532,3 +533,4 @@ _res_hconf_trim_domains (struct hostent *hp)
   for (i = 0; hp->h_aliases[i]; ++i)
     _res_hconf_trim_domain (hp->h_aliases[i]);
 }
+#endif