Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Jan 2008 15:52:54 -0500
From:      David Schultz <das@FreeBSD.ORG>
To:        Maxim Konovalov <maxim@FreeBSD.ORG>
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:  <20080112205254.GB3090@VARK.MIT.EDU>
In-Reply-To: <200801122037.m0CKb6CS009262@repoman.freebsd.org>
References:  <200801122037.m0CKb6CS009262@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080112205254.GB3090>