Date: Sun, 13 Jan 2008 14:57:49 +0100 From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@des.no> To: Maxim Konovalov <maxim@macomnet.ru> Cc: cvs-src@FreeBSD.ORG, src-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/usr.sbin/iostat iostat.c Message-ID: <86ve5xq142.fsf@ds4.des.no> In-Reply-To: <20080112211919.GA3408@VARK.MIT.EDU> (David Schultz's message of "Sat\, 12 Jan 2008 16\:19\:19 -0500") References: <200801122037.m0CKb6CS009262@repoman.freebsd.org> <20080112205254.GB3090@VARK.MIT.EDU> <20080112235350.C10888@mp2.macomnet.net> <20080112211919.GA3408@VARK.MIT.EDU>
next in thread | previous in thread | raw e-mail | index | archive | help
David Schultz <das@FreeBSD.ORG> writes: > Maxim Konovalov <maxim@macomnet.ru> writes: > > err(1, "asprintf") was my first version, yes. But I failed to find in > > the man page it sets errno. Thanks for the review, I'll fix the typo > > shortly. > 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). DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86ve5xq142.fsf>