From owner-svn-src-head@FreeBSD.ORG Fri May 11 17:56:26 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 D7306106566C; Fri, 11 May 2012 17:56:26 +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 3CBD98FC14; Fri, 11 May 2012 17:56:26 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by vniz.net (8.14.5/8.14.5) with ESMTP id q4BHuOrQ021606; Fri, 11 May 2012 21:56:24 +0400 (MSK) (envelope-from ache@vniz.net) Received: (from ache@localhost) by localhost (8.14.5/8.14.5/Submit) id q4BHuOba021605; Fri, 11 May 2012 21:56:24 +0400 (MSK) (envelope-from ache) Date: Fri, 11 May 2012 21:56:24 +0400 From: Andrey Chernov To: Konstantin Belousov Message-ID: <20120511175624.GA21202@vniz.net> Mail-Followup-To: Andrey Chernov , Konstantin Belousov , Konstantin Belousov , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG References: <201205111129.q4BBT85G081093@svn.freebsd.org> <20120511145432.GA19173@vniz.net> <20120511170412.GR2358@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="1yeeQ81UyVL57Vl7" Content-Disposition: inline In-Reply-To: <20120511170412.GR2358@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG, Konstantin Belousov Subject: Re: svn commit: r235266 - 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: Fri, 11 May 2012 17:56:26 -0000 --1yeeQ81UyVL57Vl7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, May 11, 2012 at 08:04:12PM +0300, Konstantin Belousov wrote: > On Fri, May 11, 2012 at 06:54:32PM +0400, Andrey Chernov wrote: > > Thanks, but in this two places old errno value should be saved across > > free() because free() may damage it: > I do not agree. free() cannot change errno. Perhaps I forget something, so please refer to standard stating that. IEEE Std 1003.1-2008 says that "No errors are defined." in the ERRORS=20 section, but states that beforehand: "if the argument does not match a pointer earlier returned by a function=20 in POSIX.1-2008 that allocates memory as if by malloc(), or if the space ha= s=20 been deallocated by a call to free() or realloc(), the behavior is=20 undefined. Any use of a pointer that refers to freed space results in undefined=20 behavior. =2E.. The DESCRIPTION is updated to clarify that if the pointer returned is not= =20 by a function that allocates memory as if by malloc(), then the behavior=20 is undefined." So that "undefined behavior" case still can modify errno. (Some internal syscalls (like munmap etc) could produce errno. In any=20 case it is very implemetation defined.) --=20 http://ache.vniz.net/ --1yeeQ81UyVL57Vl7 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAk+tUsgACgkQVg5YK5ZEdN0b8gCfUwWDCgWdiU802+IcvPqYY4ku 7ggAoLggsKfmilwvKhvLQBjln3rQhj1H =q0hH -----END PGP SIGNATURE----- --1yeeQ81UyVL57Vl7--