[LTP] [PATCH 2/2] ltp-aiodio: report posix_memalign errors properly

Eryu Guan eguan@redhat.com
Wed May 4 05:25:53 CEST 2016


On Tue, May 03, 2016 at 02:49:08PM +0200, Cyril Hrubis wrote:
> Hi!
> >  int dio_sparse(char *filename, int align, int writesize, int filesize)
> >  {
> > -	int fd;
> > +	int fd, ret;
> >  	void *bufptr;
> >  	int i, w;
> >  
> > @@ -68,9 +69,10 @@ int dio_sparse(char *filename, int align, int writesize, int filesize)
> >  
> >  	SAFE_FTRUNCATE(cleanup, fd, filesize);
> >  
> > -	if (posix_memalign(&bufptr, align, writesize)) {
> > +	ret = posix_memalign(&bufptr, align, writesize);
> > +	if (ret) {
> > +		tst_resm(TBROK, "posix_memalign(): %s", strerror(ret));
> 
> We should use tst_strerrno() instead of strerror().

Thanks, new stuff learned, I'm still not so familiar with ltp APIs :)

> 
> >  		close(fd);
> > -		tst_resm(TBROK | TERRNO, "posix_memalign()");
> >  		return 1;
> >  	}
> 
> Otherwise this looks fine.

Thanks for the review!

Eryu


More information about the ltp mailing list