diff mbox

[v2] Fix build with --enable-static-nss

Message ID a53c8e80-b298-8823-39bd-f211b52b88b6@att.net
State New
Headers show

Commit Message

Alexey Neyman Jan. 25, 2017, 8:45 a.m. UTC
Hi,

[first version of the patch failed during normal, non-static-nss build]


A build failure was reported in Crosstool-NG when glibc is configured 
with --enable-static-nss: 
https://github.com/crosstool-ng/crosstool-ng/issues/555

The definitions in question are protected by '#ifdef USE_NSCD' while all 
their uses are inside '#ifdef USE_NSCD' blocks which are themselves 
nested inside a '#ifdef SHARED' or '#if !defined DO_STATIC_NSS || 
defined SHARED' block.


Patch attached.

Regards,
Alexey.

Comments

Adhemerval Zanella Jan. 25, 2017, 1:20 p.m. UTC | #1
LGTM, but I think we need a bugzilla to track this since it is a user visible
bug.

On 25/01/2017 06:45, Alexey Neyman wrote:
> #if defined USE_NSCD && (!defined DO_STATIC_NSS || defined SHARED)
diff mbox

Patch

From 3a36c1eea4fa3b6f3b3b43f7eb91152383ae4ad8 Mon Sep 17 00:00:00 2001
From: Alexey Neyman <stilor@att.net>
Date: Tue, 24 Jan 2017 10:31:40 -0800
Subject: [PATCH] Fix build with --enable-static-nss

* nss/nsswitch.c (nscd_init_cb, is_nscd): make the #if around definitions
  match those around use, to avoid "defined but not used" error.

Signed-off-by: Alexey Neyman <stilor@att.net>
---
 ChangeLog      | 5 +++++
 nss/nsswitch.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index fde9fd2..e6dc9a2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@ 
+2017-01-24  Alexey Neyman  <stilor@att.net>
+
+	* nss/nsswitch.c (nscd_init_cb, is_nscd): make the #if around definitions
+	  match those around use, to avoid "defined but not used" error.
+
 2017-01-24  Jakub Jelinek  <jakub@redhat.com>
 
 	* soft-fp/op-common.h (_FP_MUL, _FP_FMA, _FP_DIV): Add
diff --git a/nss/nsswitch.c b/nss/nsswitch.c
index 0a65f6a..8f31658 100644
--- a/nss/nsswitch.c
+++ b/nss/nsswitch.c
@@ -94,7 +94,7 @@  static name_database *service_table;
 static name_database_entry *defconfig_entries;
 
 
-#ifdef USE_NSCD
+#if defined USE_NSCD && (!defined DO_STATIC_NSS || defined SHARED)
 /* Nonzero if this is the nscd process.  */
 static bool is_nscd;
 /* The callback passed to the init functions when nscd is used.  */
-- 
2.9.3