X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Ftests%2Ffsx.c;h=f645b088bc2c536c19acc43f066842b8014778da;hp=af9359952070270a92d26eff5897d6e5f74950cd;hb=b4efa1b2cbfd45f85439e1bb0a4c4eb719540dcd;hpb=d22163cb8fb913c49d492057582ff7678ee276b7;ds=sidebyside diff --git a/lustre/tests/fsx.c b/lustre/tests/fsx.c index af93599..f645b08 100644 --- a/lustre/tests/fsx.c +++ b/lustre/tests/fsx.c @@ -529,8 +529,15 @@ check_trunc_hack(void) struct stat statbuf; int fd = get_fd(); - ftruncate(fd, (off_t)0); - ftruncate(fd, (off_t)100000); + /* should not ignore ftruncate(2)'s return value */ + if (ftruncate(fd, (off_t)0) < 0) { + prterr("trunc_hack: ftruncate(0)"); + exit(1); + } + if (ftruncate(fd, (off_t)100000) < 0) { + prterr("trunc_hack: ftruncate(100000)"); + exit(1); + } if (fstat(fd, &statbuf)) { prterr("trunc_hack: fstat"); statbuf.st_size = -1; @@ -539,7 +546,10 @@ check_trunc_hack(void) prt("no extend on truncate! not posix!\n"); exit(130); } - ftruncate(fd, 0); + if (ftruncate(fd, 0) < 0) { + prterr("trunc_hack: ftruncate(0) (2nd call)"); + exit(1); + } } static char *tf_buf = NULL;