From patchwork Sat Mar 3 15:51:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Schwab X-Patchwork-Id: 881057 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-90755-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="CKQ1HOq5"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ztrJZ3NLhz9s8k for ; Sun, 4 Mar 2018 02:51:57 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:mime-version :content-type; q=dns; s=default; b=Da4ngrKCdnzC0UIUYz1s5a30Q+eGF V07rFx/FDO39/rRXdL1bg0K/g8Bh30U6bMex+kVZ4GzzwR79rKh2A/Jf2AT2MQWS ZNoY2iwzP22rsCeCFqKGAxW5HYknj4VVg6q6c87pT47j+m4dI/3CQB9mwCN4c+W7 39BaX+YzkOIQDA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:mime-version :content-type; s=default; bh=00haFkb9Rs6AU5R1RC6oJC8mVMM=; b=CKQ 1HOq5GHfik/nrcRIZcmLWN+SSv5dhCC/Yy8auCLLFuOtUGfN+cgOeZ52gV8vym1H YF66eq+cxP+yOAr/145f3net+MGBGyK29BuCKD2N7vbk7QcLsZ345peI+R6bIEAY XGbp2Rd+ACULGuS3U3DaX5j5eChcoBxwoCZZsXzw= Received: (qmail 37124 invoked by alias); 3 Mar 2018 15:51:52 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 36722 invoked by uid 89); 3 Mar 2018 15:51:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy= X-HELO: mail-out.m-online.net X-Auth-Info: inmgdAO1Q89soYgp7Dn8DDPzS+PGcqwOQQJvDiDKT81SDDODym9R9O8kfq0sSFlV From: Andreas Schwab To: libc-alpha@sourceware.org Subject: [PATCH] Fix multiple definitions of __nss_*_database (bug 22918) X-Yow: WHOA!! Ken and Barbie are having TOO MUCH FUN!! It must be the NEGATIVE IONS!! Date: Sat, 03 Mar 2018 16:51:45 +0100 Message-ID: <874llxjgxa.fsf@linux-m68k.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.91 (gnu/linux) MIME-Version: 1.0 [BZ #22918] * nss/nsswitch.h (DEFINE_DATABASE): Don't define __nss_*_database. * nss/nsswitch.c (DEFINE_DATABASE): Define __nss_*_database here. * nscd/gai.c (__nss_hosts_database): Readd definition. * posix/tst-rfc3484.c (__nss_hosts_database): Likewise. * posix/tst-rfc3484-3.c (__nss_hosts_database): Likewise. * posix/tst-rfc3484-2.c (__nss_hosts_database): Likewise. Reviewed-by: Carlos O'Donell --- nscd/gai.c | 3 +++ nss/nsswitch.c | 2 +- nss/nsswitch.h | 8 ++++---- posix/tst-rfc3484-2.c | 1 + posix/tst-rfc3484-3.c | 1 + posix/tst-rfc3484.c | 1 + 6 files changed, 11 insertions(+), 5 deletions(-) diff --git a/nscd/gai.c b/nscd/gai.c index d081747797..576fd0045b 100644 --- a/nscd/gai.c +++ b/nscd/gai.c @@ -45,3 +45,6 @@ #ifdef HAVE_LIBIDN # include #endif + +/* Some variables normally defined in libc. */ +service_user *__nss_hosts_database attribute_hidden; diff --git a/nss/nsswitch.c b/nss/nsswitch.c index 4b8deedabf..ee46f24424 100644 --- a/nss/nsswitch.c +++ b/nss/nsswitch.c @@ -62,7 +62,7 @@ static service_library *nss_new_service (name_database *database, /* Declare external database variables. */ #define DEFINE_DATABASE(name) \ - extern service_user *__nss_##name##_database attribute_hidden; \ + service_user *__nss_##name##_database attribute_hidden; \ weak_extern (__nss_##name##_database) #include "databases.def" #undef DEFINE_DATABASE diff --git a/nss/nsswitch.h b/nss/nsswitch.h index eccb535ef5..63573b9ebc 100644 --- a/nss/nsswitch.h +++ b/nss/nsswitch.h @@ -226,10 +226,10 @@ libc_hidden_proto (__nss_hostname_digits_dots) #define MAX_NR_ADDRS 48 /* Prototypes for __nss_*_lookup2 functions. */ -#define DEFINE_DATABASE(arg) \ - service_user *__nss_##arg##_database attribute_hidden; \ - int __nss_##arg##_lookup2 (service_user **, const char *, \ - const char *, void **); \ +#define DEFINE_DATABASE(arg) \ + extern service_user *__nss_##arg##_database attribute_hidden; \ + int __nss_##arg##_lookup2 (service_user **, const char *, \ + const char *, void **); \ libc_hidden_proto (__nss_##arg##_lookup2) #include "databases.def" #undef DEFINE_DATABASE diff --git a/posix/tst-rfc3484-2.c b/posix/tst-rfc3484-2.c index f509534ca9..8c64ac59ff 100644 --- a/posix/tst-rfc3484-2.c +++ b/posix/tst-rfc3484-2.c @@ -58,6 +58,7 @@ _res_hconf_init (void) #undef USE_NSCD #include "../sysdeps/posix/getaddrinfo.c" +service_user *__nss_hosts_database attribute_hidden; /* This is the beginning of the real test code. The above defines (among other things) the function rfc3484_sort. */ diff --git a/posix/tst-rfc3484-3.c b/posix/tst-rfc3484-3.c index ae44087a10..1c61aaf844 100644 --- a/posix/tst-rfc3484-3.c +++ b/posix/tst-rfc3484-3.c @@ -58,6 +58,7 @@ _res_hconf_init (void) #undef USE_NSCD #include "../sysdeps/posix/getaddrinfo.c" +service_user *__nss_hosts_database attribute_hidden; /* This is the beginning of the real test code. The above defines (among other things) the function rfc3484_sort. */ diff --git a/posix/tst-rfc3484.c b/posix/tst-rfc3484.c index 7f191abbbc..8f45848e44 100644 --- a/posix/tst-rfc3484.c +++ b/posix/tst-rfc3484.c @@ -58,6 +58,7 @@ _res_hconf_init (void) #undef USE_NSCD #include "../sysdeps/posix/getaddrinfo.c" +service_user *__nss_hosts_database attribute_hidden; /* This is the beginning of the real test code. The above defines (among other things) the function rfc3484_sort. */