From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7251 invoked by alias); 16 Aug 2007 10:51:58 -0000 Received: (qmail 7216 invoked by uid 22791); 16 Aug 2007 10:51:57 -0000 X-Spam-Check-By: sourceware.org Received: from sunsite.ms.mff.cuni.cz (HELO sunsite.mff.cuni.cz) (195.113.15.26) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 16 Aug 2007 10:51:53 +0000 Received: from sunsite.mff.cuni.cz (localhost.localdomain [127.0.0.1]) by sunsite.mff.cuni.cz (8.13.8/8.13.8) with ESMTP id l7GAw1wl016316 for ; Thu, 16 Aug 2007 12:58:01 +0200 Received: (from jakub@localhost) by sunsite.mff.cuni.cz (8.13.8/8.13.8/Submit) id l7GAw1qs016311 for binutils@sources.redhat.com; Thu, 16 Aug 2007 12:58:01 +0200 Date: Thu, 16 Aug 2007 10:51:00 -0000 From: Jakub Jelinek To: binutils@sources.redhat.com Subject: [PATCH] Fix bfd build with CVS glibc Message-ID: <20070816105800.GB2279@sunsite.mff.cuni.cz> Reply-To: Jakub Jelinek Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.2i Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2007-08/txt/msg00233.txt.bz2 Hi! open in CVS glibc with -D_FORTIFY_SOURCE{,=2} is implemented as a function-like macro so that it can check for invalid open uses like open ("foo", O_CREAT|O_RDWR); or open ("foo", flags); where flags is not known at compile time, but at runtime contains O_CREAT bit set. This is not violating POSIX, as POSIX permits standard functions to be implemented as function-like macros. opncls.c includes , so open can be implemented as function-like macro and is in the glibc case. The following spot in bfd_openr_iovec doesn't call open function though, but calls a function pointer open passed as parameter to the function. The following prevents it being expanded as function-like macro, ok for trunk and 2.18 branch? Alternative fix would be (also standard conforming) #undef open after including the headers, but that would mean the real open(1) calls in the file are not checked. 2007-08-16 Jakub Jelinek * opncls.c (bfd_openr_iovec): Surround open with parentheses. --- bfd/opncls.c.jj 2007-08-01 09:11:48.000000000 -0400 +++ bfd/opncls.c 2007-08-16 06:23:39.000000000 -0400 @@ -545,7 +545,7 @@ bfd_openr_iovec (const char *filename, c nbfd->filename = filename; nbfd->direction = read_direction; - stream = open (nbfd, open_closure); + stream = (open) (nbfd, open_closure); if (stream == NULL) { _bfd_delete_bfd (nbfd); Jakub