svn commit: r236582 - head/lib/libc/stdlib
Andrey Chernov
ache at FreeBSD.ORG
Tue Jun 5 14:03:43 UTC 2012
On Mon, Jun 04, 2012 at 09:34:49PM +0000, Andrey A. Chernov wrote:
> 1) IEEE Std 1003.1-2008, "errno" section, is explicit that
>
> "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."
>
> However, free() in IEEE Std 1003.1-2008 does not mention its interaction
> with errno, so MAY modify it after successful call
> (it depends on particular free() implementation, OS-specific, etc.).
I see this subject brings some attention, so I prefer to exmpain details.
Here is the quote from the future standard change:
http://austingroupbugs.net/view.php?id=385
"However, earlier versions of this standard did not require this, and the
same example had to be written as:
// buf was obtained by malloc(buflen)
ret = write(fd, buf, buflen);
if (ret < 0) {
int save = errno;
free(buf);
errno = save;
return ret;
}
"
All we have now is "earlier version of standard". Until they'll publish
future version, we need to stay this recommendation.
--
http://ache.vniz.net/
More information about the svn-src-head
mailing list