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

@ -1,3 +1,12 @@
2013-04-12 Roland McGrath <roland@hack.frob.com>
Xavier Roche <roche+kml2@exalead.com>
[BZ #15361]
* sysdeps/pthread/aio_fsync.c (aio_fsync): Don't check open modes,
just that it's a file descriptor.
* manual/llio.texi (Synchronizing AIO Operations): Update description
for EBADF error from aio_fsync.
2013-04-12 Siddhesh Poyarekar <siddhesh@redhat.com>
* Rules (bench): Move target definition...

2
NEWS
View file

@ -14,7 +14,7 @@ Version 2.18
14920, 14964, 14981, 14982, 14985, 14994, 14996, 15003, 15006, 15020,
15023, 15036, 15054, 15055, 15062, 15078, 15160, 15214, 15232, 15234,
15283, 15285, 15287, 15304, 15305, 15307, 15309, 15327, 15330, 15335,
15336, 15337, 15342, 15346.
15336, 15337, 15342, 15346, 15361.
* CVE-2013-0242 Buffer overrun in regexp matcher has been fixed (Bugzilla
#15078).

View file

@ -2320,8 +2320,7 @@ successfully enqueued. Otherwise the return value is @math{-1} and
@item EAGAIN
The request could not be enqueued due to temporary lack of resources.
@item EBADF
The file descriptor @code{aiocbp->aio_fildes} is not valid or not open
for writing.
The file descriptor @code{@var{aiocbp}->aio_fildes} is not valid.
@item EINVAL
The implementation does not support I/O synchronization or the @var{op}
parameter is other than @code{O_DSYNC} and @code{O_SYNC}.

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;