summaryrefslogtreecommitdiff
path: root/nscd
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-08-25 18:55:07 +0000
committerJakub Jelinek <jakub@redhat.com>2007-08-25 18:55:07 +0000
commitdd3394742b3e2e01f403b1c1b41ed39273b2212e (patch)
tree5fed86738b0d518989679f3194f896fc9fcebbe2 /nscd
parent9b0cdd693e7f54fd35fd58931b940efe6ccb88cd (diff)
Updated to fedora-glibc-20070825T1839
Diffstat (limited to 'nscd')
-rw-r--r--nscd/Makefile3
-rw-r--r--nscd/connections.c2
-rw-r--r--nscd/gethstbyad_r.c3
-rw-r--r--nscd/gethstbynm2_r.c3
-rw-r--r--nscd/hstcache.c36
-rw-r--r--nscd/res_hconf.c13
6 files changed, 41 insertions, 19 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/connections.c b/nscd/connections.c
index 72581071af..cf6ae9a83c 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -1017,7 +1017,7 @@ cannot handle old request version %d; current version is %d"),
ssize_t nwritten;
#ifdef HAVE_SENDFILE
- if (db->mmap_used || !cached->notfound)
+ if (__builtin_expect (db->mmap_used, 1))
{
assert (db->wr_fd != -1);
assert ((char *) cached->data > (char *) db->data);
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 3c9a17fee8..54222a3408 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)
@@ -221,7 +221,7 @@ cache_addhst (struct database_dyn *db, int fd, request_header *req,
the current cache handling cannot handle and it is more than
questionable whether it is worthwhile complicating the cache
handling just for handling such a special case. */
- if (he == NULL && hst->h_addr_list[1] == NULL)
+ if (he == NULL && h_addr_list_cnt == 1)
{
dataset = (struct dataset *) mempool_alloc (db,
total + req->key_len);
@@ -298,25 +298,31 @@ cache_addhst (struct database_dyn *db, int fd, request_header *req,
/* The data has not changed. We will just bump the
timeout value. Note that the new record has been
allocated on the stack and need not be freed. */
+ assert (h_addr_list_cnt == 1);
dh->timeout = dataset->head.timeout;
++dh->nreloads;
}
else
{
- /* We have to create a new record. Just allocate
- appropriate memory and copy it. */
- struct dataset *newp
- = (struct dataset *) mempool_alloc (db, total + req->key_len);
- if (newp != NULL)
+ if (h_addr_list_cnt == 1)
{
- /* Adjust pointers into the memory block. */
- addresses = (char *) newp + (addresses - (char *) dataset);
- aliases = (char *) newp + (aliases - (char *) dataset);
- assert (key_copy != NULL);
- key_copy = (char *) newp + (key_copy - (char *) dataset);
-
- dataset = memcpy (newp, dataset, total + req->key_len);
- alloca_used = false;
+ /* We have to create a new record. Just allocate
+ appropriate memory and copy it. */
+ struct dataset *newp
+ = (struct dataset *) mempool_alloc (db,
+ total + req->key_len);
+ if (newp != NULL)
+ {
+ /* Adjust pointers into the memory block. */
+ addresses = (char *) newp + (addresses
+ - (char *) dataset);
+ aliases = (char *) newp + (aliases - (char *) dataset);
+ assert (key_copy != NULL);
+ key_copy = (char *) newp + (key_copy - (char *) dataset);
+
+ dataset = memcpy (newp, dataset, total + req->key_len);
+ alloca_used = false;
+ }
}
/* Mark the old record as obsolete. */
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"