From owner-svn-src-head@FreeBSD.ORG Tue Jun 5 14:03:43 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 742D4106564A; Tue, 5 Jun 2012 14:03:43 +0000 (UTC) (envelope-from ache@vniz.net) Received: from vniz.net (vniz.net [194.87.13.69]) by mx1.freebsd.org (Postfix) with ESMTP id E36208FC0C; Tue, 5 Jun 2012 14:03:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by vniz.net (8.14.5/8.14.5) with ESMTP id q55E3fFx015151; Tue, 5 Jun 2012 18:03:41 +0400 (MSK) (envelope-from ache@vniz.net) Received: (from ache@localhost) by localhost (8.14.5/8.14.5/Submit) id q55E3fuP015146; Tue, 5 Jun 2012 18:03:41 +0400 (MSK) (envelope-from ache) Date: Tue, 5 Jun 2012 18:03:40 +0400 From: Andrey Chernov To: src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG Message-ID: <20120605140340.GA15035@vniz.net> Mail-Followup-To: Andrey Chernov , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG References: <201206042134.q54LYoVJ067685@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201206042134.q54LYoVJ067685@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Subject: Re: svn commit: r236582 - head/lib/libc/stdlib X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jun 2012 14:03:43 -0000 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/