about summary refs log tree commit diff
path: root/nscd
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-08-22 03:14:29 +0000
committerUlrich Drepper <drepper@redhat.com>2007-08-22 03:14:29 +0000
commit1ce7d80ddc62d4bb3e8e4f89fbcb6fa21361733d (patch)
treeb94b2b37659fd22373f3f20e2ca964a46d54759c /nscd
parenta30d41c1d2c69b34e6f19dc1f92881f18e75349c (diff)
downloadglibc-1ce7d80ddc62d4bb3e8e4f89fbcb6fa21361733d.tar.gz
glibc-1ce7d80ddc62d4bb3e8e4f89fbcb6fa21361733d.tar.xz
glibc-1ce7d80ddc62d4bb3e8e4f89fbcb6fa21361733d.zip
[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.
Diffstat (limited to 'nscd')
-rw-r--r--nscd/Makefile3
-rw-r--r--nscd/gethstbyad_r.c3
-rw-r--r--nscd/gethstbynm2_r.c3
-rw-r--r--nscd/hstcache.c2
-rw-r--r--nscd/res_hconf.c13
5 files changed, 20 insertions, 4 deletions
diff --git a/nscd/Makefile b/nscd/Makefile
index ef3ce184f9..ecd8c89998 100644
--- a/nscd/Makefile
+++ b/nscd/Makefile
@@ -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
diff --git a/nscd/gethstbyad_r.c b/nscd/gethstbyad_r.c
index e0cd82c32b..e2e8dfe2cc 100644
--- a/nscd/gethstbyad_r.c
+++ b/nscd/gethstbyad_r.c
@@ -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"
diff --git a/nscd/gethstbynm2_r.c b/nscd/gethstbynm2_r.c
index abe992cc1c..85e95d4a63 100644
--- a/nscd/gethstbynm2_r.c
+++ b/nscd/gethstbynm2_r.c
@@ -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
diff --git a/nscd/hstcache.c b/nscd/hstcache.c
index 65adf318c5..74de8f6567 100644
--- a/nscd/hstcache.c
+++ b/nscd/hstcache.c
@@ -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
index 0000000000..14b0e300bc
--- /dev/null
+++ b/nscd/res_hconf.c
@@ -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"