about summary refs log tree commit diff
path: root/sysdeps/unix
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2018-02-02 10:46:26 +0100
committerFlorian Weimer <fweimer@redhat.com>2018-02-02 10:46:26 +0100
commitd4b4a00a462348750bb18544eb30853ee6ac5d10 (patch)
treeede7a1a13907496496c48e436a5b5dc85be3ac2e /sysdeps/unix
parent84c94d2fd90d84ae7e67657ee8e22c2d1b796f63 (diff)
downloadglibc-d4b4a00a462348750bb18544eb30853ee6ac5d10.tar.gz
glibc-d4b4a00a462348750bb18544eb30853ee6ac5d10.tar.xz
glibc-d4b4a00a462348750bb18544eb30853ee6ac5d10.zip
preadv2/pwritev2: Handle offset == -1 [BZ #22753]
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/preadv2.c5
-rw-r--r--sysdeps/unix/sysv/linux/preadv64v2.c6
-rw-r--r--sysdeps/unix/sysv/linux/pwritev2.c5
-rw-r--r--sysdeps/unix/sysv/linux/pwritev64v2.c5
4 files changed, 17 insertions, 4 deletions
diff --git a/sysdeps/unix/sysv/linux/preadv2.c b/sysdeps/unix/sysv/linux/preadv2.c
index 06d29b1322..c8bf0764ef 100644
--- a/sysdeps/unix/sysv/linux/preadv2.c
+++ b/sysdeps/unix/sysv/linux/preadv2.c
@@ -49,7 +49,10 @@ preadv2 (int fd, const struct iovec *vector, int count, off_t offset,
       __set_errno (ENOTSUP);
       return -1;
     }
-  return preadv (fd, vector, count, offset);
+  if (offset == -1)
+    return __readv (fd, vector, count);
+  else
+    return preadv (fd, vector, count, offset);
 }
 
 #endif
diff --git a/sysdeps/unix/sysv/linux/preadv64v2.c b/sysdeps/unix/sysv/linux/preadv64v2.c
index 58f7848352..d7400a0252 100644
--- a/sysdeps/unix/sysv/linux/preadv64v2.c
+++ b/sysdeps/unix/sysv/linux/preadv64v2.c
@@ -47,7 +47,11 @@ preadv64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
       __set_errno (ENOTSUP);
       return -1;
     }
-  return preadv64 (fd, vector, count, offset);
+
+  if (offset == -1)
+    return __readv (fd, vector, count);
+  else
+    return preadv64 (fd, vector, count, offset);
 }
 
 #ifdef __OFF_T_MATCHES_OFF64_T
diff --git a/sysdeps/unix/sysv/linux/pwritev2.c b/sysdeps/unix/sysv/linux/pwritev2.c
index d50d9f51f9..29c2264c8f 100644
--- a/sysdeps/unix/sysv/linux/pwritev2.c
+++ b/sysdeps/unix/sysv/linux/pwritev2.c
@@ -45,7 +45,10 @@ pwritev2 (int fd, const struct iovec *vector, int count, off_t offset,
       __set_errno (ENOTSUP);
       return -1;
     }
-  return pwritev (fd, vector, count, offset);
+  if (offset == -1)
+    return __writev (fd, vector, count);
+  else
+    return pwritev (fd, vector, count, offset);
 }
 
 #endif
diff --git a/sysdeps/unix/sysv/linux/pwritev64v2.c b/sysdeps/unix/sysv/linux/pwritev64v2.c
index 40c2387690..42da321149 100644
--- a/sysdeps/unix/sysv/linux/pwritev64v2.c
+++ b/sysdeps/unix/sysv/linux/pwritev64v2.c
@@ -47,7 +47,10 @@ pwritev64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
       __set_errno (ENOTSUP);
       return -1;
     }
-  return pwritev64 (fd, vector, count, offset);
+  if (offset == -1)
+    return __writev (fd, vector, count);
+  else
+    return pwritev64 (fd, vector, count, offset);
 }
 
 #ifdef __OFF_T_MATCHES_OFF64_T