[LTP] [PATCH 2/2] ltp-aiodio: report posix_memalign errors properly
Cyril Hrubis
chrubis@suse.cz
Tue May 3 14:49:08 CEST 2016
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().
> close(fd);
> - tst_resm(TBROK | TERRNO, "posix_memalign()");
> return 1;
> }
Otherwise this looks fine.
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list