From owner-freebsd-amd64@FreeBSD.ORG Fri Jan 16 09:38:20 2009 Return-Path: Delivered-To: amd64@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B517E10656D9 for ; Fri, 16 Jan 2009 09:38:20 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.freebsd.org (Postfix) with SMTP id 191248FC0C for ; Fri, 16 Jan 2009 09:38:19 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: (qmail invoked by alias); 16 Jan 2009 09:38:18 -0000 Received: from p54A3E7DB.dip.t-dialin.net (EHLO tron.homeunix.org) [84.163.231.219] by mail.gmx.net (mp046) with SMTP; 16 Jan 2009 10:38:18 +0100 X-Authenticated: #1673122 X-Provags-ID: V01U2FsdGVkX1+j4g4acfqj1tOvhWSSKqOJjmun4qhgh7CQjnDg4t dFqZbVvF84PYZd Message-ID: <4970558A.1010705@gmx.de> Date: Fri, 16 Jan 2009 10:38:18 +0100 From: Christoph Mallon User-Agent: Thunderbird 2.0.0.19 (X11/20090103) MIME-Version: 1.0 To: Garrett Cooper References: <7d6fde3d0901160041n55466290l55f737d274a40895@mail.gmail.com> <49704AEC.3080709@gmx.de> <7d6fde3d0901160056y7c395cb1m4675a3957b85f33d@mail.gmail.com> <49704C13.60505@gmx.de> <7d6fde3d0901160058x785b0af7r741fc779eb537d5@mail.gmail.com> <7d6fde3d0901160119u7ca9606dw55300cd279410ad2@mail.gmail.com> In-Reply-To: <7d6fde3d0901160119u7ca9606dw55300cd279410ad2@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-FuHaFi: 0.57 X-Mailman-Approved-At: Fri, 16 Jan 2009 12:24:48 +0000 Cc: "amd64@freebsd.org" , Hackers freeBSD Subject: Re: Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl(3) setting `odd' errno's X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jan 2009 09:38:21 -0000 Garrett Cooper schrieb: > On Fri, Jan 16, 2009 at 12:58 AM, Garrett Cooper wrote: >> On Fri, Jan 16, 2009 at 12:57 AM, Christoph Mallon >> wrote: >>> Garrett Cooper schrieb: >>>> Good point. I modified the source to do that. >>>> Thanks, >>>> -Garrett >>> You should reply to all so the discussion stays on the list. >> Yeah, that was a goofup on my part. Go-go Gmail web interface! >> -Garrett > > Hmmm... looks like the strerror issue it could be a serious bug: > > #include > #include > #include > > int > main() > { > > struct stat sb; > > int o_errno; > > if (stat("/some/file/that/doesn't/exist", &sb) != 0) { > o_errno = errno; > printf("Errno: %d\n", errno); > err(errno, "%s", strerror(o_errno)); You are still using the wrong errno. Also err() itself prints the error string using strerror(). There might be some interference when the result of one call to strerror() (your call) is used after another call to strerror() (err() internally). I doubt there is a bug in the library, otherwise we would see many bugreports of segfaults on AMD64.