From owner-freebsd-hackers@FreeBSD.ORG Wed Jun 1 15:54:08 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A218106566C for ; Wed, 1 Jun 2011 15:54:08 +0000 (UTC) (envelope-from aehlig@linta.de) Received: from linta.de (isilmar-3.linta.de [188.40.101.200]) by mx1.freebsd.org (Postfix) with ESMTP id D6FCC8FC12 for ; Wed, 1 Jun 2011 15:54:07 +0000 (UTC) Received: (qmail 19764 invoked by uid 10); 1 Jun 2011 15:27:25 -0000 Received: from kta1c10 by isilmar.linta.de with BSMTP; 1 Jun 2011 15:27:25 -0000 Received: by kta1c10.sesnet.soton.ac.uk (Postfix, from userid 1001) id CA6973981D; Wed, 1 Jun 2011 16:27:13 +0100 (BST) Date: Wed, 1 Jun 2011 16:27:13 +0100 From: "Klaus T. Aehlig" To: freebsd-hackers@freebsd.org Message-ID: <20110601152713.GB51073@kta1c10.sesnet.soton.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Mailman-Approved-At: Wed, 01 Jun 2011 16:31:51 +0000 Subject: fdopendir prototype on 7.3-RELEASE amd64 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 15:54:08 -0000 [Please CC me, as I'm not subscribed to this list] Hallo, while dealing with PR ports/157274 [1], I found that the following program cause a segmentation fault on 7.3-RELEASE amd64, even though my understanding of the man page of fdopendir(3) says it should not. #include #include #include int main(int argc, char **argv) { DIR *dirp; int fd; fd = open(".", O_RDONLY); dirp = fdopendir(fd); (void) readdir(dirp); } Compiling gives the warning "assignment makes pointer from integer without a cast" refering to the line with the fdopendir call. Indeed, adding the prototype extern DIR *fdopendir(int); right after the #include lines solves this problem. Is my understanding of the man page that the above #include lines should suffice incorrect? Is this problem known---or even fixed already? I have reports that indicate that this problem also seems to exist on 7.3-RELEASE-p4 amd64 and 8.1-RELEASE i386. The above program does not segfault on my 8.2-STABLE amd64. Any hints on the status of this observation are very welcome. Best regards, Klaus [1] http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/157274