From owner-freebsd-hackers@FreeBSD.ORG Wed Jun 1 17:31:24 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 52F9D106564A for ; Wed, 1 Jun 2011 17:31:24 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-vx0-f182.google.com (mail-vx0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id 07E768FC13 for ; Wed, 1 Jun 2011 17:31:23 +0000 (UTC) Received: by vxc34 with SMTP id 34so32061vxc.13 for ; Wed, 01 Jun 2011 10:31:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=YLRMn3GTsbsdxh8G5PjWsZ6Hi4IYrxjDTRMb5BV0Jjk=; b=A1Z18DCOvPJaRZL3Zqi/1NyuSxPACeXZPlNI5X5EAWxwccLrkYEvgwu+e/kGMiTO4g h6Rgp1iLQJJIiZWZUbWB4DRUootVIepASYwlUKY9f/bHXO0HqANI066r4PJQCkWU5FkT lDbp6FtVQNMNa76qmvXYH9nqdEFdgnosPic8M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=wpOMcjOIFM/KwawfQpwT1yv3bbD+zlj4oRXK7PDh/aqW2Uh2VG1dL21UnucCA9vO61 wNdCGYbaRAXQ6CtnRCYIaAHOjrlDbVdr8i772LBR4RJVRv/Fckf6KoB6khJGFestRdJF v7f6CNtGF50EDF/+y3x2NLhsSsyHO9mInQt68= Received: by 10.52.94.170 with SMTP id dd10mr3177099vdb.159.1306947620327; Wed, 01 Jun 2011 10:00:20 -0700 (PDT) Received: from oddish.mark-home (Mail1.sandvine.com [64.7.137.162]) by mx.google.com with ESMTPS id q1sm505023vdt.23.2011.06.01.10.00.19 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 01 Jun 2011 10:00:19 -0700 (PDT) Date: Wed, 1 Jun 2011 13:00:17 -0400 From: Mark Johnston To: "Klaus T. Aehlig" Message-ID: <20110601170017.GB1830@oddish.mark-home> References: <20110601152713.GB51073@kta1c10.sesnet.soton.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110601152713.GB51073@kta1c10.sesnet.soton.ac.uk> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-hackers@freebsd.org Subject: Re: 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 17:31:24 -0000 On Wed, Jun 01, 2011 at 04:27:13PM +0100, Klaus T. Aehlig wrote: > > [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 > This has been fixed (in include/dirent.h) with r205265 on RELENG_7, but I can't see how you'd run into the problem on 8.1. The problem was that the fdopendir prototype was missing from dirent.h, so the code was compiled using the incorrect prototype "int fdopendir()". -Mark