From patchwork Fri Nov 21 18:54:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 3842 Received: (qmail 6009 invoked by alias); 21 Nov 2014 18:54:23 -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 5999 invoked by uid 89); 21 Nov 2014 18:54:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Date: Fri, 21 Nov 2014 18:54:16 +0000 From: Joseph Myers To: Subject: Fix perror fileno namespace (bug 17633) Message-ID: User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 perror, an ISO C function, uses fileno, which is not an ISO C function. This patch makes it use __fileno instead. (The nearby call to fdopen is not a problem because that's #defined to _IO_new_fdopen.) Tested for x86_64 (testsuite, and that installed stripped shared libraries are unchanged by this patch). 2014-11-21 Joseph Myers [BZ #17633] * stdio-common/perror.c (perror): Call __fileno instead of fileno. * conform/Makefile (test-xfail-ISO/stdio.h/linknamespace): Remove variable. (test-xfail-ISO99/stdio.h/linknamespace): Likewise. (test-xfail-ISO11/stdio.h/linknamespace): Likewise. diff --git a/conform/Makefile b/conform/Makefile index cf54722..4a498e4 100644 --- a/conform/Makefile +++ b/conform/Makefile @@ -325,12 +325,9 @@ test-xfail-XOPEN2K/ndbm.h/linknamespace = yes test-xfail-XOPEN2K8/ndbm.h/linknamespace = yes # Unsorted expected failures. -test-xfail-ISO/stdio.h/linknamespace = yes test-xfail-ISO/time.h/linknamespace = yes test-xfail-ISO99/ctype.h/linknamespace = yes -test-xfail-ISO99/stdio.h/linknamespace = yes test-xfail-ISO11/ctype.h/linknamespace = yes -test-xfail-ISO11/stdio.h/linknamespace = yes test-xfail-XPG3/ctype.h/linknamespace = yes test-xfail-XPG3/fnmatch.h/linknamespace = yes test-xfail-XPG3/glob.h/linknamespace = yes diff --git a/stdio-common/perror.c b/stdio-common/perror.c index 4b47015..7de83e4 100644 --- a/stdio-common/perror.c +++ b/stdio-common/perror.c @@ -56,7 +56,7 @@ perror (const char *s) oriented yet? In this case we'll create a new stream which is using the same underlying file descriptor. */ if (__builtin_expect (_IO_fwide (stderr, 0) != 0, 1) - || (fd = fileno (stderr)) == -1 + || (fd = __fileno (stderr)) == -1 || (fd = __dup (fd)) == -1 || (fp = fdopen (fd, "w+")) == NULL) {