From b31606c0e1d9f04e2498b7c8262f7de87daa7ce7 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Fri, 28 Sep 2012 18:35:43 +0200 Subject: aio_fsync: fix the access mode check Make use of O_ACCMODE and O_RDONLY instead of assuming details of the O_* flags. --- sysdeps/pthread/aio_fsync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sysdeps') 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; -- cgit 1.4.1