On Sat, Jan 12, 2008, Maxim Konovalov wrote:
> On Sat, 12 Jan 2008, 15:52-0500, David Schultz wrote:
> 
> > On Sat, Jan 12, 2008, Maxim Konovalov wrote:
> > > -                 asprintf(&devname, "%s%d",
> > > +                 if (asprintf(&devname, "%s%d",
> > >                       cur.dinfo->devices[di].device_name,
> > > -                     cur.dinfo->devices[di].unit_number);
> > > +                     cur.dinfo->devices[di].unit_number) == 1)
> > > +                         errx(1, "asprintf() failed (out of memory?)");
> >
> > err(1, "asprintf") will produce a more meaningful error message,
> > by the way. Also, I think you wanted to compare the return value
> > of asprintf to -1 instead of 1.
> >
> 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".
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to