From 6bbf07e6c4475928de5a5005c1fb5804e3cebcde Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 9 May 2023 09:19:07 +0200 Subject: [PATCH] tests: Use F_(OFD)SETLK(64) in test_fcntl_lock Signed-off-by: Andreas Schneider Reviewed-by: Andrew Bartlett --- tests/test_fcntl_lock.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/test_fcntl_lock.c b/tests/test_fcntl_lock.c index 98cf7c0..6bf2cd1 100644 --- a/tests/test_fcntl_lock.c +++ b/tests/test_fcntl_lock.c @@ -52,6 +52,13 @@ static void test_fcntl_lock(void **state) int fd, rc; struct flock lock; char *s = (char *)*state; + int cmd = F_SETLK; +#ifdef F_SETLK64 + cmd = F_SETLK64; +#endif +#ifdef F_OFD_SETLK + cmd = F_OFD_SETLK; +#endif rc = snprintf(file, sizeof(file), "%s/file", s); assert_in_range(rc, 0, PATH_MAX); @@ -65,7 +72,7 @@ static void test_fcntl_lock(void **state) lock.l_len = 4; lock.l_pid = 0; - rc = fcntl(fd, F_SETLK, &lock); + rc = fcntl(fd, cmd, &lock); assert_return_code(rc, errno); rc = unlink(file); -- 2.34.1