From b2179107f3eabb5e349333cd5adc6e2fb4431990 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Thu, 24 Jan 2013 12:32:09 +0100 Subject: Properly cache the result from looking up the nss database config --- nscd/aicache.c | 15 +++++++-------- nscd/initgrcache.c | 15 +++++++-------- 2 files changed, 14 insertions(+), 16 deletions(-) (limited to 'nscd') diff --git a/nscd/aicache.c b/nscd/aicache.c index fd55852..713e41a 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)) diff --git a/nscd/initgrcache.c b/nscd/initgrcache.c index 462780e..4580884 100644 --- a/nscd/initgrcache.c +++ b/nscd/initgrcache.c @@ -80,17 +80,16 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req, } static service_user *group_database; - service_user *nip = NULL; + service_user *nip; int no_more; - if (group_database != NULL) - { - nip = group_database; - no_more = 0; - } - else + if (group_database == NULL) no_more = __nss_database_lookup ("group", NULL, - "compat [NOTFOUND=return] files", &nip); + "compat [NOTFOUND=return] files", + &group_database); + else + no_more = 0; + nip = group_database; /* We always use sysconf even if NGROUPS_MAX is defined. That way, the limit can be raised in the kernel configuration without having to -- cgit v1.1