summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2013-04-12 13:11:20 -0700
committerRoland McGrath <roland@hack.frob.com>2013-04-12 13:11:20 -0700
commit477925062fd2fb720c54a17d15f512247860e34a (patch)
tree4a9dc41862eadcef1d72f402a08449a50db6caec /sysdeps
parent8fc1bee546c01b2b6975e4cb07be70cc531aa754 (diff)
downloadglibc-477925062fd2fb720c54a17d15f512247860e34a.tar.gz
glibc-477925062fd2fb720c54a17d15f512247860e34a.tar.xz
glibc-477925062fd2fb720c54a17d15f512247860e34a.zip
BZ#15361: Make aio_fsync not check open modes.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/pthread/aio_fsync.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/sysdeps/pthread/aio_fsync.c b/sysdeps/pthread/aio_fsync.c
index 79b3583bd1..1e5a2584fb 100644
--- a/sysdeps/pthread/aio_fsync.c
+++ b/sysdeps/pthread/aio_fsync.c
@@ -36,17 +36,14 @@
 int
 aio_fsync (int op, struct aiocb *aiocbp)
 {
-  int flags;
-
   if (op != O_DSYNC && __builtin_expect (op != O_SYNC, 0))
     {
       __set_errno (EINVAL);
       return -1;
     }
 
-  flags = fcntl (aiocbp->aio_fildes, F_GETFL);
-  if (__builtin_expect (flags == -1, 0)
-      || __builtin_expect ((flags & O_ACCMODE) == O_RDONLY, 0))
+  /* Verify that this is an open file descriptor.  */
+  if (__glibc_unlikely (fcntl (aiocbp->aio_fildes, F_GETFL) == -1))
     {
       __set_errno (EBADF);
       return -1;