From owner-svn-src-head@FreeBSD.ORG Tue Jun 5 14:31:17 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ECA0C1065673; Tue, 5 Jun 2012 14:31:17 +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 648288FC0C; Tue, 5 Jun 2012 14:31:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by vniz.net (8.14.5/8.14.5) with ESMTP id q55EVFQj015774; Tue, 5 Jun 2012 18:31:15 +0400 (MSK) (envelope-from ache@vniz.net) Received: (from ache@localhost) by localhost (8.14.5/8.14.5/Submit) id q55EVFN9015773; Tue, 5 Jun 2012 18:31:15 +0400 (MSK) (envelope-from ache) Date: Tue, 5 Jun 2012 18:31:14 +0400 From: Andrey Chernov To: Joerg Sonnenberger Message-ID: <20120605143114.GA15710@vniz.net> Mail-Followup-To: Andrey Chernov , Joerg Sonnenberger , svn-src-all@FreeBSD.ORG, Dimitry Andric , src-committers@FreeBSD.ORG, svn-src-head@FreeBSD.ORG References: <201206042134.q54LYoVJ067685@svn.freebsd.org> <4FCDBE69.6080906@FreeBSD.org> <20120605123901.GA13306@vniz.net> <20120605125520.GA12045@britannica.bec.de> <20120605131305.GF13306@vniz.net> <20120605142510.GB13416@britannica.bec.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120605142510.GB13416@britannica.bec.de> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG, Dimitry Andric 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:31:18 -0000 On Tue, Jun 05, 2012 at 04:25:10PM +0200, Joerg Sonnenberger wrote: > > Please see > > http://austingroupbugs.net/view.php?id=385 > > That is about explicitly recognizing how stupid the notion of free(3) > not preserving errno is. Seriously, before you start to randomly bloat > code all over the place, restricting the behavior of free(3) to be > sensible is a much saner option. I agree that saving errno inside free() itself will make life easy, but I just follow their recommendation: "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 this standard". Until they'll publish the future version, we can't ignore the recommendation. BTW, if general consensus will be to track unpublished standard, I will back out my change (in hope our malloc() maintainer will change free() to directly save errno). -- http://ache.vniz.net/