]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
BZ#15361: Make aio_fsync not check open modes.
authorRoland McGrath <roland@hack.frob.com>
Fri, 12 Apr 2013 20:11:20 +0000 (13:11 -0700)
committerRoland McGrath <roland@hack.frob.com>
Fri, 12 Apr 2013 20:11:20 +0000 (13:11 -0700)
ChangeLog
NEWS
manual/llio.texi
sysdeps/pthread/aio_fsync.c

index 9757623081b937559f3ac2c5cd93fb854e2815fa..96be3baeb5b79c5c2d98ff912bdcc868369fd170 100644 (file)
--- 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 66efb82dfdf17435641fe56d7be79d410a6df9e5..e2d71be98221fa8a72814025f74168676af949e8 100644 (file)
--- 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).
index 90bd2d71f783369a875fa569fd7dafdf95267d25..b129cf40bd7c4593a5b83a98681d4c09bb7e1a6b 100644 (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}.
index 79b3583bd1d36b94bd4b96b0481f836cf4464005..1e5a2584fbbe134aa0021cec23492b32f670f85a 100644 (file)
 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;