aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2013-04-12 13:11:20 -0700
committerRoland McGrath <roland@hack.frob.com>2013-04-12 13:11:20 -0700
commit477925062fd2fb720c54a17d15f512247860e34a (patch)
tree4a9dc41862eadcef1d72f402a08449a50db6caec
parent8fc1bee546c01b2b6975e4cb07be70cc531aa754 (diff)
downloadglibc-477925062fd2fb720c54a17d15f512247860e34a.zip
glibc-477925062fd2fb720c54a17d15f512247860e34a.tar.gz
glibc-477925062fd2fb720c54a17d15f512247860e34a.tar.bz2
BZ#15361: Make aio_fsync not check open modes.
-rw-r--r--ChangeLog9
-rw-r--r--NEWS2
-rw-r--r--manual/llio.texi3
-rw-r--r--sysdeps/pthread/aio_fsync.c7
4 files changed, 13 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 9757623..96be3ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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...
diff --git a/NEWS b/NEWS
index 66efb82..e2d71be 100644
--- a/NEWS
+++ b/NEWS
@@ -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).
diff --git a/manual/llio.texi b/manual/llio.texi
index 90bd2d7..b129cf4 100644
--- a/manual/llio.texi
+++ b/manual/llio.texi
@@ -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}.
diff --git a/sysdeps/pthread/aio_fsync.c b/sysdeps/pthread/aio_fsync.c
index 79b3583..1e5a258 100644
--- a/sysdeps/pthread/aio_fsync.c
+++ b/sysdeps/pthread/aio_fsync.c
@@ -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;