1
0
mirror of https://sourceware.org/git/glibc.git synced 2026-01-06 11:51:29 +03:00

BZ#15361: Make aio_fsync not check open modes.

This commit is contained in:
Roland McGrath
2013-04-12 13:11:20 -07:00
parent 8fc1bee546
commit 477925062f
4 changed files with 13 additions and 8 deletions

View File

@@ -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;