mirror of
https://sourceware.org/git/glibc.git
synced 2025-12-24 17:51:17 +03:00
Update.
2002-06-18 Amos Waterland <apw@us.ibm.com> * sysdeps/pthread/aio_cancel.c (aio_cancel): Add check for invalid file descriptor. * sysdeps/pthread/aio_fsync.c (aio_fsync): Add check for invalid fd; add check for fd not open for writing. * sysdeps/pthread/aio_suspend.c (aio_suspend): Add check for completed element(s) and do not suspend thread if so. Patch heavily modified by drepper. * rt/tst-aio7.c: New file. Regression test for problems which the above three changes fix. * rt/Makefile (tests): Add tst-aio7. * rt/tst-aio6.c: Fix comment.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/* Synchronize I/O in given file descriptor.
|
||||
Copyright (C) 1997, 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 1999, 2002 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
@@ -36,12 +36,22 @@
|
||||
int
|
||||
aio_fsync (int op, struct aiocb *aiocbp)
|
||||
{
|
||||
if (op != O_DSYNC && op != O_SYNC)
|
||||
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_RDWR | O_WRONLY)) == 0, 0))
|
||||
{
|
||||
__set_errno (EBADF);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return (__aio_enqueue_request ((aiocb_union *) aiocbp,
|
||||
op == O_SYNC ? LIO_SYNC : LIO_DSYNC) == NULL
|
||||
? -1 : 0);
|
||||
|
||||
Reference in New Issue
Block a user