]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
posix: Set p{read,write}v2 to return ENOTSUP (BZ#21780)
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 17 Jul 2017 13:59:59 +0000 (10:59 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 8 Aug 2017 12:59:46 +0000 (09:59 -0300)
Different than other architectures hppa-linux-gnu define different values
for ENOTSUP and EOPNOTSUPP, where the later is a Linux specific one.
This leads to tst-preadwritev{64}v2 tests failures:

$ ./testrun.sh misc/tst-preadvwritev2
error: tst-preadvwritev2-common.c:35: preadv2 failure did not set errno to ENOTSUP (223)
error: 1 test failures

The straightforward fix is to return the POSIX defined ENOTSUP on all
p{read,write}v{64}v2 implementations instead of Linux specific one.

Checked on x86_64-linux-gnu and the tst-preadwritev{64}v2 on
hppa-linux-gnu (although due the installed kernel on my testing system
the pwritev{64}v2 with an invalid flag still fails due a known kernel
issue [1]).

[BZ #21780]
* sysdeps/posix/preadv2.c (preadv2): Use ENOTSUP instead of
EOPNOTSUPP.
* sysdeps/posix/preadv64v2.c (preadv64v2): Likewise.
* sysdeps/posix/pwritev2.c (pwritev2): Likewise.
* sysdeps/posix/pwritev64v2.c (pwritev64v2): Likewise.
* sysdeps/unix/sysv/linux/preadv2.c (preadv2): Likewise.
* sysdeps/unix/sysv/linux/preadv64v2.c (preadv64v2): Likewise.
* sysdeps/unix/sysv/linux/pwritev2.c (pwritev2): Likewise.
* sysdeps/unix/sysv/linux/pwritev64v2.c (pwritev64v2): Likewise.

[1] https://sourceware.org/ml/libc-alpha/2017-06/msg00726.html

ChangeLog
sysdeps/posix/preadv2.c
sysdeps/posix/preadv64v2.c
sysdeps/posix/pwritev2.c
sysdeps/posix/pwritev64v2.c
sysdeps/unix/sysv/linux/preadv2.c
sysdeps/unix/sysv/linux/preadv64v2.c
sysdeps/unix/sysv/linux/pwritev2.c
sysdeps/unix/sysv/linux/pwritev64v2.c

index 6add9dc4fa11662d75813762cfb41b99355591a6..28051e07fec97ef880ec791ebebd32db597be65f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2017-08-07  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
+
+       [BZ #21780]
+       * sysdeps/posix/preadv2.c (preadv2): Use ENOTSUP instead of
+       EOPNOTSUPP.
+       * sysdeps/posix/preadv64v2.c (preadv64v2): Likewise.
+       * sysdeps/posix/pwritev2.c (pwritev2): Likewise.
+       * sysdeps/posix/pwritev64v2.c (pwritev64v2): Likewise.
+       * sysdeps/unix/sysv/linux/preadv2.c (preadv2): Likewise.
+       * sysdeps/unix/sysv/linux/preadv64v2.c (preadv64v2): Likewise.
+       * sysdeps/unix/sysv/linux/pwritev2.c (pwritev2): Likewise.
+       * sysdeps/unix/sysv/linux/pwritev64v2.c (pwritev64v2): Likewise.
+
 2017-08-07  Joseph Myers  <joseph@codesourcery.com>
 
        [BZ #21899]
index 2a7cf11e2762b8820c64c2a9264966deb481d25a..d27f7028ed8754aed1ee4fa3b1644b17ccf277c4 100644 (file)
@@ -28,7 +28,7 @@ preadv2 (int fd, const struct iovec *vector, int count, OFF_T offset,
 {
   if (flags != 0)
     {
-      __set_errno (EOPNOTSUPP);
+      __set_errno (ENOTSUP);
       return -1;
     }
 
index e084f3f9e141a202db7eaeb3c274b904aeba0e61..ce7cb40bf2014ddc72f9a057b72985d2e5143152 100644 (file)
@@ -25,7 +25,7 @@ preadv64v2 (int fd, const struct iovec *vector, int count, OFF_T offset,
 {
   if (flags != 0)
     {
-      __set_errno (EOPNOTSUPP);
+      __set_errno (ENOTSUP);
       return -1;
     }
 
index 5b7650c4fc02a2ac85afe3e3c967b4adc57f7444..7ec8cbc4074a3c0aeb016a71ce51aa52ba3f3e88 100644 (file)
@@ -28,7 +28,7 @@ pwritev2 (int fd, const struct iovec *vector, int count, OFF_T offset,
 {
   if (flags != 0)
     {
-      __set_errno (EOPNOTSUPP);
+      __set_errno (ENOTSUP);
       return -1;
     }
 
index 0f2f9ef863c85f50877757829e165d0442f590b9..be98aeed9d574beb7ccf32b676df1d584cd22abb 100644 (file)
@@ -26,7 +26,7 @@ pwritev64v2 (int fd, const struct iovec *vector, int count, OFF_T offset,
 {
   if (flags != 0)
     {
-      __set_errno (EOPNOTSUPP);
+      __set_errno (ENOTSUP);
       return -1;
     }
 
index 11fe85eaa842a642f2c6f9cefdd8ccb245a75ae9..137e2dd7913f3264e7203ae6a7cbc2308f4fc886 100644 (file)
@@ -32,7 +32,7 @@ preadv2 (int fd, const struct iovec *vector, int count, off_t offset,
 # ifdef __NR_preadv2
   ssize_t result = SYSCALL_CANCEL (preadv2, fd, vector, count,
                                   LO_HI_LONG (offset), flags);
-  if (result >= 0 || errno != ENOSYS)
+  if (result >= 0)
     return result;
 # endif
   /* Trying to emulate the preadv2 syscall flags is troublesome:
@@ -46,7 +46,7 @@ preadv2 (int fd, const struct iovec *vector, int count, off_t offset,
 
   if (flags != 0)
     {
-      __set_errno (EOPNOTSUPP);
+      __set_errno (ENOTSUP);
       return -1;
     }
   return preadv (fd, vector, count, offset);
index 9d7f8c989387e6846ef564f6faa74b86639609bd..8f413253f458dfeb9df09dcdcbfcea08808bf46e 100644 (file)
@@ -30,7 +30,7 @@ preadv64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
 #ifdef __NR_preadv64v2
   ssize_t result = SYSCALL_CANCEL (preadv64v2, fd, vector, count,
                                   LO_HI_LONG (offset), flags);
-  if (result >= 0 || errno != ENOSYS)
+  if (result >= 0)
     return result;
 #endif
   /* Trying to emulate the preadv2 syscall flags is troublesome:
@@ -44,7 +44,7 @@ preadv64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
 
   if (flags != 0)
     {
-      __set_errno (EOPNOTSUPP);
+      __set_errno (ENOTSUP);
       return -1;
     }
   return preadv64 (fd, vector, count, offset);
index 72f0471f969ac6dbbcd4fc456766ee3f29e02237..8e5032fe2feda8f21c927762a9e86f9531fe490c 100644 (file)
@@ -28,7 +28,7 @@ pwritev2 (int fd, const struct iovec *vector, int count, off_t offset,
 # ifdef __NR_pwritev2
   ssize_t result = SYSCALL_CANCEL (pwritev2, fd, vector, count,
                                   LO_HI_LONG (offset), flags);
-  if (result >= 0 || errno != ENOSYS)
+  if (result >= 0)
     return result;
 # endif
   /* Trying to emulate the pwritev2 syscall flags is troublesome:
@@ -42,7 +42,7 @@ pwritev2 (int fd, const struct iovec *vector, int count, off_t offset,
 
   if (flags != 0)
     {
-      __set_errno (EOPNOTSUPP);
+      __set_errno (ENOTSUP);
       return -1;
     }
   return pwritev (fd, vector, count, offset);
index def9a0bc57c33436e1e25515d2edd3d4b08bb47f..d2800c6657fa406538369e2573802b6cba51765d 100644 (file)
@@ -30,7 +30,7 @@ pwritev64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
 #ifdef __NR_pwritev64v2
   ssize_t result = SYSCALL_CANCEL (pwritev64v2, fd, vector, count,
                                   LO_HI_LONG (offset), flags);
-  if (result >= 0 || errno != ENOSYS)
+  if (result >= 0)
     return result;
 #endif
   /* Trying to emulate the pwritev2 syscall flags is troublesome:
@@ -44,7 +44,7 @@ pwritev64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
 
   if (flags != 0)
     {
-      __set_errno (EOPNOTSUPP);
+      __set_errno (ENOTSUP);
       return -1;
     }
   return pwritev64 (fd, vector, count, offset);