Date: Tue, 5 Jun 2012 18:03:40 +0400 From: Andrey Chernov <ache@FreeBSD.ORG> To: src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG Subject: Re: svn commit: r236582 - head/lib/libc/stdlib Message-ID: <20120605140340.GA15035@vniz.net> In-Reply-To: <201206042134.q54LYoVJ067685@svn.freebsd.org> References: <201206042134.q54LYoVJ067685@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120605140340.GA15035>