summary refs log tree commit diff
path: root/nscd/aicache.c
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2013-01-24 12:32:09 +0100
committerAndreas Schwab <schwab@suse.de>2013-09-30 10:29:13 +0200
commitb2179107f3eabb5e349333cd5adc6e2fb4431990 (patch)
tree1a723f6ae54607a352f17983db026987734cf10c /nscd/aicache.c
parent47f28d0a6627c8b263df3c3e8f905bfaf42557bc (diff)
downloadglibc-b2179107f3eabb5e349333cd5adc6e2fb4431990.tar.gz
glibc-b2179107f3eabb5e349333cd5adc6e2fb4431990.tar.xz
glibc-b2179107f3eabb5e349333cd5adc6e2fb4431990.zip
Properly cache the result from looking up the nss database config
Diffstat (limited to 'nscd/aicache.c')
-rw-r--r--nscd/aicache.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/nscd/aicache.c b/nscd/aicache.c
index fd55852ed8..713e41a2e8 100644
--- a/nscd/aicache.c
+++ b/nscd/aicache.c
@@ -86,20 +86,19 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req,
     }
 
   static service_user *hosts_database;
-  service_user *nip = NULL;
+  service_user *nip;
   int no_more;
   int rc6 = 0;
   int rc4 = 0;
   int herrno = 0;
 
-  if (hosts_database != NULL)
-    {
-      nip = hosts_database;
-      no_more = 0;
-    }
-  else
+  if (hosts_database == NULL)
     no_more = __nss_database_lookup ("hosts", NULL,
-				     "dns [!UNAVAIL=return] files", &nip);
+				     "dns [!UNAVAIL=return] files",
+				     &hosts_database);
+  else
+    no_more = 0;
+  nip = hosts_database;
 
   /* Initialize configurations.  */
   if (__glibc_unlikely (!_res_hconf.initialized))