]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
aio_fsync: fix the access mode check
authorPino Toscano <toscano.pino@tiscali.it>
Fri, 28 Sep 2012 16:35:43 +0000 (18:35 +0200)
committerPino Toscano <toscano.pino@tiscali.it>
Fri, 28 Sep 2012 16:35:43 +0000 (18:35 +0200)
Make use of O_ACCMODE and O_RDONLY instead of assuming details of the O_* flags.

ChangeLog
sysdeps/pthread/aio_fsync.c

index 27cf3a95030fb88cf86985e78785e08b76638f07..207519baee70a1f9223506baf159a06465ec9879 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-09-28  Pino Toscano  <toscano.pino@tiscali.it>
+
+       * sysdeps/pthread/aio_fsync.c: Fix the file mode checking.
+
 2012-09-28  Dmitry V. Levin  <ldv@altlinux.org>
 
        [BZ #11438]
index 046e25c171dacc50630d9a2e3cd304c4cf089755..5b5d1863e7c241de4f72da6c0f6416446559a912 100644 (file)
@@ -46,7 +46,7 @@ aio_fsync (int op, struct aiocb *aiocbp)
 
   flags = fcntl (aiocbp->aio_fildes, F_GETFL);
   if (__builtin_expect (flags == -1, 0)
-      || __builtin_expect ((flags & (O_RDWR | O_WRONLY)) == 0, 0))
+      || __builtin_expect ((flags & O_ACCMODE) == O_RDONLY, 0))
     {
       __set_errno (EBADF);
       return -1;