public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] nss: Reconcile conditional declaration and use of `is_nscd'
@ 2023-05-11 15:09 Arjun Shankar
  2023-05-15 14:09 ` Carlos O'Donell
  0 siblings, 1 reply; 2+ messages in thread
From: Arjun Shankar @ 2023-05-11 15:09 UTC (permalink / raw)
  To: libc-alpha; +Cc: Arjun Shankar

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.
---
 nss/nss_module.c | 6 +++---
 1 file 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.  */
-- 
2.40.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] nss: Reconcile conditional declaration and use of `is_nscd'
  2023-05-11 15:09 [PATCH] nss: Reconcile conditional declaration and use of `is_nscd' Arjun Shankar
@ 2023-05-15 14:09 ` Carlos O'Donell
  0 siblings, 0 replies; 2+ messages in thread
From: Carlos O'Donell @ 2023-05-15 14:09 UTC (permalink / raw)
  To: Arjun Shankar, libc-alpha

On 5/11/23 11:09, Arjun Shankar via Libc-alpha wrote:
> 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.

LGTM.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  nss/nss_module.c | 6 +++---
>  1 file 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;

OK. The is_nscd is only available for shared (in addition to using NSCD). This has
nothing to do with DO_STATIC_NSS today.

>  /* 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

OK.

>    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

OK.

>    if (is_nscd)
>      {
>        /* Call the init function when nscd is used.  */

-- 
Cheers,
Carlos.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-15 14:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-11 15:09 [PATCH] nss: Reconcile conditional declaration and use of `is_nscd' Arjun Shankar
2023-05-15 14:09 ` Carlos O'Donell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).