cvs commit: src/usr.sbin/iostat iostat.c

Dag-Erling Smørgrav des at des.no
Sun Jan 13 05:57:59 PST 2008


David Schultz <das at FreeBSD.ORG> writes:
> Maxim Konovalov <maxim at 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
-- 
Dag-Erling Smørgrav - des at des.no


More information about the cvs-src mailing list