From owner-cvs-all@FreeBSD.ORG Sun Jan 13 17:44:22 2008 Return-Path: Delivered-To: cvs-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3576616A418; Sun, 13 Jan 2008 17:44:22 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail02.syd.optusnet.com.au (mail02.syd.optusnet.com.au [211.29.132.183]) by mx1.freebsd.org (Postfix) with ESMTP id C020E13C43E; Sun, 13 Jan 2008 17:44:21 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c211-30-219-213.carlnfd3.nsw.optusnet.com.au [211.30.219.213]) by mail02.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id m0DHi8in017760 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 14 Jan 2008 04:44:10 +1100 Date: Mon, 14 Jan 2008 04:44:08 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= In-Reply-To: <86ve5xq142.fsf@ds4.des.no> Message-ID: <20080114042508.X11683@besplex.bde.org> References: <200801122037.m0CKb6CS009262@repoman.freebsd.org> <20080112205254.GB3090@VARK.MIT.EDU> <20080112235350.C10888@mp2.macomnet.net> <20080112211919.GA3408@VARK.MIT.EDU> <86ve5xq142.fsf@ds4.des.no> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1524310525-1200246248=:11683" Cc: cvs-src@FreeBSD.org, Maxim Konovalov , src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/usr.sbin/iostat iostat.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Jan 2008 17:44:22 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1524310525-1200246248=:11683 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Sun, 13 Jan 2008, [utf-8] Dag-Erling Sm=C3=B8rgrav wrote: > David Schultz writes: >> I don't think it always does set errno, but you can set errno to 0 >> before the call, and you'll get either the real error message from >> err() or "unknown error". > > If asprintf() fails because malloc() failed, malloc() will have set > errno to ENOMEM. I can't think of any other failure mode for asprintf() > that won't either be silently ignored (error in format string) or result > in a segmentation fault (bogus argument to %s). FreeBSD vfprintf.c doesn't touch errno directly, but POSIX with XSI bugfeatures says that it sets errno to EILSEQ or EINVAL if it fails with certain errors. Also, when the printf variant is printf or fprintf, it may set errno to ENOMEM, and when it is snprintf it may set errno to EOVERFLOW for the non-error of passing a buffer size of > INT_MAX (with a buffer that large) or for the error of the the result wanting to be larger than INT_MAX. POSIX is standardizing the behaviour in the latter case and might require it to set errno (FreeBSD vfprintf.c just returns EOF). Bruce --0-1524310525-1200246248=:11683--