From owner-freebsd-bugs@FreeBSD.ORG Mon Jun 28 20:20:06 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E50A1065674 for ; Mon, 28 Jun 2010 20:20:06 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 1DFBA8FC13 for ; Mon, 28 Jun 2010 20:20:06 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o5SKK3Zq063674 for ; Mon, 28 Jun 2010 20:20:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o5SKK3OG063671; Mon, 28 Jun 2010 20:20:03 GMT (envelope-from gnats) Date: Mon, 28 Jun 2010 20:20:03 GMT Message-Id: <201006282020.o5SKK3OG063671@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Jaakko Heinonen Cc: Subject: Re: kern/144307: ENOENT set unnecessarily under certain circumstances when malloc is called / fails X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Jaakko Heinonen List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jun 2010 20:20:06 -0000 The following reply was made to PR kern/144307; it has been noted by GNATS. From: Jaakko Heinonen To: Garrett Cooper Cc: bug-followup@freebsd.org Subject: Re: kern/144307: ENOENT set unnecessarily under certain circumstances when malloc is called / fails Date: Mon, 28 Jun 2010 23:10:11 +0300 On 2010-06-28, Garrett Cooper wrote: > Or the malloc(3) call could be fixed with the couple of lines I > noted (well, adlibbed of course... > > Which I agree with, but shouldn't we fix malloc(3) (and any other > function calls that depend on malloc(3) for sensible results)? It's not required for POSIX compliance at least. Did you actually read the quotes from POSIX? "The value of errno should only be examined when it is indicated to be valid by a function's return value." "The setting of errno after a successful call to a function is unspecified unless the description of that function specifies that errno shall not be modified." In other words the value of errno is undefined and shouldn't be examined unless malloc(3) returns NULL. -- Jaakko