Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Jun 2010 22:20:03 GMT
From:      Garrett Cooper <gcooper@FreeBSD.org>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: kern/144307: ENOENT set unnecessarily under certain circumstances when malloc is called / fails
Message-ID:  <201006282220.o5SMK3E5066344@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/144307; it has been noted by GNATS.

From: Garrett Cooper <gcooper@FreeBSD.org>
To: Jaakko Heinonen <jh@freebsd.org>
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 15:17:32 -0700

 On Mon, Jun 28, 2010 at 1:10 PM, Jaakko Heinonen <jh@freebsd.org> wrote:
 > On 2010-06-28, Garrett Cooper wrote:
 >> =A0 =A0 Or the malloc(3) call could be fixed with the couple of lines I
 >> noted (well, adlibbed of course...
 >>
 >> =A0 =A0 Which I agree with, but shouldn't we fix malloc(3) (and any othe=
 r
 >> 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.
 
     Ok. The bsdlabel(8) item is valid, but in the meantime I'll write
 some testcases for read(2) to see whether or not I can find the
 recreate the failing condition when =3D=3D -1. Worst case we'll have more
 testcases to put in the tree...
 Thanks!
 -Garrett



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006282220.o5SMK3E5066344>