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

David Schultz das at FreeBSD.ORG
Sat Jan 12 12:52:57 PST 2008


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.


More information about the cvs-all mailing list