From patchwork Thu Feb 19 15:32:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 441673 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 69F6F140151 for ; Fri, 20 Feb 2015 02:32:45 +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:date:from:to:subject:message-id:mime-version :content-type; q=dns; s=default; b=gdHrd2x9fsiODVoOCp0zYIlQjig7S haPNadBcGult3FmjXJIyX2D4dqq1SP9jBdQv0T98jkEP2y6Y90u4LqagZkQem2Hx +YP7yFD4Q0GEY4q073TavOvY1Hx2b0xIR5gSaQUb4SlV2q18KTVaXDtgabMQYbS8 ++msydvCiQkEcw= 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:date:from:to:subject:message-id:mime-version :content-type; s=default; bh=eDYZlRKsnluM0EM06S3GIORNoOY=; b=Sw7 qM283XMh65MMdApO0UCwXUuJxotpuOftvbLd/h7v/ViuSxg2OB2iSx4USk8t+uH2 4sz83qvwhpAskG04lIWvgiSYzlLur97IrKXgTG+2FFgHsDSg4P1benYP5J3J1i+c Uzy5anA5QrFc4X7Ky3qXRMPe215njabCRooTN6mI= Received: (qmail 21554 invoked by alias); 19 Feb 2015 15:32:38 -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 21491 invoked by uid 89); 19 Feb 2015 15:32:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Date: Thu, 19 Feb 2015 15:32:31 +0000 From: Joseph Myers To: Subject: Fix scandir scandirat namespace (bug 17999) Message-ID: User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 The POSIX function scandir calls scandirat, which is not a POSIX function. This patch fixes this by making it use __scandirat and making scandirat a weak alias. There are no changes for scandir64 / scandirat64 because those are both _GNU_SOURCE-only functions so no namespace issue arises for them. Tested for x86_64 that the disassembly of installed shared libraries is unchanged by this patch. 2015-02-19 Joseph Myers [BZ #17999] * dirent/scandir.c [!SCANDIR] (SCANDIRAT): Define to __scandirat instead of scandirat. * dirent/scandirat.c [!SCANDIRAT] (SCANDIRAT): Likewise. [!SCANDIRAT] (SCANDIRAT_WEAK_ALIAS): Define. [SCANDIRAT_WEAK_ALIAS] (scandirat): Define as weak alias of __scandirat. * include/dirent.h (scandirat): Do not use libc_hidden_proto. (__scandirat): Declare. Use libc_hidden_proto. * conform/Makefile (test-xfail-POSIX2008/dirent.h/linknamespace): Remove variable. (test-xfail-XOPEN2K8/dirent.h/linknamespace): Likewise. diff --git a/conform/Makefile b/conform/Makefile index 39f41bd..3f9721a 100644 --- a/conform/Makefile +++ b/conform/Makefile @@ -393,13 +393,11 @@ test-xfail-XOPEN2K/syslog.h/linknamespace = yes test-xfail-XOPEN2K/ucontext.h/linknamespace = yes test-xfail-XOPEN2K/unistd.h/linknamespace = yes test-xfail-XOPEN2K/wordexp.h/linknamespace = yes -test-xfail-POSIX2008/dirent.h/linknamespace = yes test-xfail-POSIX2008/grp.h/linknamespace = yes test-xfail-POSIX2008/netdb.h/linknamespace = yes test-xfail-POSIX2008/regex.h/linknamespace = yes test-xfail-POSIX2008/semaphore.h/linknamespace = yes test-xfail-POSIX2008/unistd.h/linknamespace = yes -test-xfail-XOPEN2K8/dirent.h/linknamespace = yes test-xfail-XOPEN2K8/fmtmsg.h/linknamespace = yes test-xfail-XOPEN2K8/grp.h/linknamespace = yes test-xfail-XOPEN2K8/netdb.h/linknamespace = yes diff --git a/dirent/scandir.c b/dirent/scandir.c index 1039b9b..99c9681 100644 --- a/dirent/scandir.c +++ b/dirent/scandir.c @@ -28,7 +28,7 @@ #ifndef SCANDIR # define SCANDIR scandir -# define SCANDIRAT scandirat +# define SCANDIRAT __scandirat # define DIRENT_TYPE struct dirent #endif diff --git a/dirent/scandirat.c b/dirent/scandirat.c index 1147cee..004b152 100644 --- a/dirent/scandirat.c +++ b/dirent/scandirat.c @@ -30,9 +30,10 @@ #include #ifndef SCANDIRAT -# define SCANDIRAT scandirat +# define SCANDIRAT __scandirat # define READDIR __readdir # define DIRENT_TYPE struct dirent +# define SCANDIRAT_WEAK_ALIAS #endif #ifndef SKIP_SCANDIR_CANCEL @@ -148,6 +149,9 @@ SCANDIRAT (dfd, dir, namelist, select, cmp) return c.cnt; } libc_hidden_def (SCANDIRAT) +#ifdef SCANDIRAT_WEAK_ALIAS +weak_alias (__scandirat, scandirat) +#endif #ifdef _DIRENT_MATCHES_DIRENT64 weak_alias (scandirat, scandirat64) diff --git a/include/dirent.h b/include/dirent.h index e8e9e42..2e797ae 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -50,7 +50,8 @@ extern void __scandir_cancel_handler (void *arg); extern __typeof (rewinddir) __rewinddir; libc_hidden_proto (__rewinddir) -libc_hidden_proto (scandirat) +extern __typeof (scandirat) __scandirat; +libc_hidden_proto (__scandirat) libc_hidden_proto (scandirat64) # endif