about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--sysdeps/pthread/aio_fsync.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 27cf3a9503..207519baee 100644
--- 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]
diff --git a/sysdeps/pthread/aio_fsync.c b/sysdeps/pthread/aio_fsync.c
index 046e25c171..5b5d1863e7 100644
--- a/sysdeps/pthread/aio_fsync.c
+++ b/sysdeps/pthread/aio_fsync.c
@@ -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;