[LTP] [PATCH] nfs_flock: fail the test if lock/unlock ops fail
Nikita Yushchenko
nikita.yushchenko@virtuozzo.com
Wed Jan 12 17:19:41 CET 2022
Since nfs_flock is testing locking operations, ignoring errors returned
from those operations is nonsense.
Signed-off-by: Nikita Yushchenko <nikita.yushchenko@virtuozzo.com>
---
testcases/network/nfs/nfslock01/nfs_flock.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/testcases/network/nfs/nfslock01/nfs_flock.c b/testcases/network/nfs/nfslock01/nfs_flock.c
index a7673c751..a13ddd251 100644
--- a/testcases/network/nfs/nfslock01/nfs_flock.c
+++ b/testcases/network/nfs/nfslock01/nfs_flock.c
@@ -63,16 +63,20 @@ int main(int argc, char **argv)
continue;
}
- if (writeb_lock(fd, offset, SEEK_SET, BYTES) < 0)
- printf("failed in writeb_lock, Errno = %d", errno);
+ if (writeb_lock(fd, offset, SEEK_SET, BYTES) < 0) {
+ printf("failed in writeb_lock, Errno = %d\n", errno);
+ exit(1);
+ }
lseek(fd, offset, SEEK_SET);
/* write to the test file */
write(fd, buf, BYTES);
- if (unb_lock(fd, offset, SEEK_SET, BYTES) < 0)
- printf("failed in unb_lock, Errno = %d", errno);
+ if (unb_lock(fd, offset, SEEK_SET, BYTES) < 0) {
+ printf("failed in unb_lock, Errno = %d\n", errno);
+ exit(1);
+ }
}
exit(0);
}
--
2.30.2
More information about the ltp
mailing list