about summary refs log tree commit diff
path: root/nss
diff options
context:
space:
mode:
authorArjun Shankar <arjun@redhat.com>2023-05-11 14:54:11 +0200
committerArjun Shankar <arjun@redhat.com>2023-05-16 11:40:10 +0200
commitbea1a4a77305cef90dac47b873bd9f01a6409c22 (patch)
tree29014ffcf6761eecff4234300bc9d5353fac59d7 /nss
parenteeef96f56ce399f2c3fc1d93c0ba1dde34f3ae41 (diff)
downloadglibc-bea1a4a77305cef90dac47b873bd9f01a6409c22.tar.gz
glibc-bea1a4a77305cef90dac47b873bd9f01a6409c22.tar.xz
glibc-bea1a4a77305cef90dac47b873bd9f01a6409c22.zip
nss: Reconcile conditional declaration and use of `is_nscd'
This change harmonizes the declaration and use of `is_nscd' and fixes a
build failure with the "--enable-static-nss --enable-nscd"
configuration options due to `is_nscd' being used undeclared.

The purpose of `is_nscd' is to avoid (nss <-> nscd) recursion in
dynamically linked libc (SHARED) that is nscd-aware (USE_NSCD), and so
its declaration and use should be guarded by the definition of those
macros.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'nss')
-rw-r--r--nss/nss_module.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/nss/nss_module.c b/nss/nss_module.c
index 487e513def..0104f88974 100644
--- a/nss/nss_module.c
+++ b/nss/nss_module.c
@@ -53,7 +53,7 @@ static struct nss_module *nss_module_list;
    modules.  */
 __libc_lock_define (static, nss_module_list_lock);
 
-#if defined USE_NSCD && (!defined DO_STATIC_NSS || defined SHARED)
+#if defined SHARED && defined USE_NSCD
 /* Nonzero if this is the nscd process.  */
 static bool is_nscd;
 /* The callback passed to the init functions when nscd is used.  */
@@ -147,7 +147,7 @@ module_load_builtin (struct nss_module *module,
 static bool
 module_load_nss_files (struct nss_module *module)
 {
-#ifdef USE_NSCD
+#if defined SHARED && defined USE_NSCD
   if (is_nscd)
     {
       void (*cb) (size_t, struct traced_file *) = nscd_init_cb;
@@ -238,7 +238,7 @@ module_load (struct nss_module *module)
       PTR_MANGLE (pointers[idx]);
     }
 
-# ifdef USE_NSCD
+# if defined SHARED && defined USE_NSCD
   if (is_nscd)
     {
       /* Call the init function when nscd is used.  */