tests: Use F_(OFD)SETLK(64) in test_fcntl_lock
authorAndreas Schneider <asn@samba.org>
Tue, 9 May 2023 07:19:07 +0000 (09:19 +0200)
committerAndreas Schneider <asn@samba.org>
Tue, 20 Jun 2023 11:38:45 +0000 (13:38 +0200)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
tests/test_fcntl_lock.c

index 98cf7c0dedf968a29dd3a571788ccb9494357d69..6bf2cd160ab7e84a6bdc548f0f754e3fe42cc815 100644 (file)
@@ -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);