]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix Linux fcntl OFD locks on unsupported kernels
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 27 Jul 2018 13:07:14 +0000 (10:07 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 27 Jul 2018 17:48:06 +0000 (14:48 -0300)
This patch make the OFD tests return unsupported if kernel does not
support OFD locks (it was added on 3.15).

Checked on a ia64-linux-gnu with Linux 3.14.

* sysdeps/unix/sysv/linux/tst-ofdlocks.c: Return unsupported if
kernel does not support OFD locks.
* sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c: Likewise.

ChangeLog
sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c
sysdeps/unix/sysv/linux/tst-ofdlocks.c

index 562ddc7a00d537086dc87a2c9b0f28439f5a235a..50fc501865d15996f3a947d12bd7d987a25d00cb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2018-07-27  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
+
+       * sysdeps/unix/sysv/linux/tst-ofdlocks.c: Return unsupported if
+       kernel does not support OFD locks.
+       * sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c: Likewise.
+
 2018-07-27  Samuel Thibault  <samuel.thibault@ens-lyon.org>
 
        * sysdeps/mach/hurd/Versions (libc): Make __access and
index 03c4abfeffde5bed0b5c949e4e9aa58e4aae6b5f..aaf65af0db4b1f5f4a9bc871c9ebc098ce2dc0a7 100644 (file)
@@ -62,7 +62,12 @@ do_test (void)
     .l_start  = (off64_t)INT32_MAX + 1024,
     .l_len    = 1024,
   };
-  TEST_VERIFY_EXIT (fcntl (temp_fd, F_OFD_SETLKW, &lck64) == 0);
+  int ret = fcntl (temp_fd, F_OFD_SETLKW, &lck64);
+  if (ret == -1 && errno == EINVAL)
+    /* OFD locks are only available on Linux 3.15.  */
+    FAIL_UNSUPPORTED ("fcntl (F_OFD_SETLKW) not supported");
+
+  TEST_VERIFY_EXIT (ret == 0);
 
   /* Open file description locks placed through the same open file description
      (either by same file descriptor or a duplicated one created by fork,
index bd345e9b6493e7eb03c25f4348a276f46ef1b572..a660bab6dd9e66507393d2588d226b227e187470 100644 (file)
@@ -46,7 +46,12 @@ do_test (void)
     .l_start  = (off64_t)INT32_MAX + 1024,
     .l_len    = 1024,
   };
-  TEST_VERIFY_EXIT (fcntl64 (temp_fd, F_OFD_SETLKW, &lck64) == 0);
+  int ret = fcntl64 (temp_fd, F_OFD_SETLKW, &lck64);
+  if (ret == -1 && errno == EINVAL)
+    /* OFD locks are only available on Linux 3.15.  */
+    FAIL_UNSUPPORTED ("fcntl (F_OFD_SETLKW) not supported");
+
+  TEST_VERIFY_EXIT (ret == 0);
 
   /* Open file description locks placed through the same open file description
      (either by same file descriptor or a duplicated one created by fork,