2010-09-24 Ralf Corsépius <ralf.corsepius@rtems.org>

* posix/src/aio_cancel.c: Spray pthread_mutex_unlocks.
This commit is contained in:
Ralf Corsepius
2010-08-24 12:04:43 +00:00
parent e4522091c9
commit 89dbb28bd4
2 changed files with 9 additions and 7 deletions

View File

@@ -1,5 +1,6 @@
2010-09-24 Ralf Corsépius <ralf.corsepius@rtems.org> 2010-09-24 Ralf Corsépius <ralf.corsepius@rtems.org>
* posix/src/aio_cancel.c: Spray pthread_mutex_unlocks.
* posix/src/aio_read.c: aio_nbytes is always >= 0. * posix/src/aio_read.c: aio_nbytes is always >= 0.
* posix/src/aio_write.c: aio_nbytes is always >= 0. * posix/src/aio_write.c: aio_nbytes is always >= 0.
Fix typo in comment. Fix typo in comment.
@@ -31,7 +32,6 @@
2010-08-23 Joel Sherrill <joel.sherrill@oarcorp.com> 2010-08-23 Joel Sherrill <joel.sherrill@oarcorp.com>
CID 79/DEADCODE CID 79/DEADCODE
CID 78/DEADCODE CID 78/DEADCODE
CID 77/DEADCODE CID 77/DEADCODE

View File

@@ -45,9 +45,11 @@ int aio_cancel(int fildes, struct aiocb *aiocbp)
if (aiocbp == NULL) if (aiocbp == NULL)
{ {
if (fcntl (fildes, F_GETFL) < 0) if (fcntl (fildes, F_GETFL) < 0) {
pthread_mutex_unlock(&aio_request_queue.mutex);
rtems_set_errno_and_return_minus_one (EBADF); rtems_set_errno_and_return_minus_one (EBADF);
}
r_chain = rtems_aio_search_fd (&aio_request_queue.work_req, r_chain = rtems_aio_search_fd (&aio_request_queue.work_req,
fildes, fildes,
0); 0);
@@ -58,8 +60,10 @@ int aio_cancel(int fildes, struct aiocb *aiocbp)
r_chain = rtems_aio_search_fd (&aio_request_queue.idle_req, r_chain = rtems_aio_search_fd (&aio_request_queue.idle_req,
fildes, fildes,
0); 0);
if (r_chain == NULL) if (r_chain == NULL) {
pthread_mutex_unlock(&aio_request_queue.mutex);
return AIO_ALLDONE; return AIO_ALLDONE;
}
rtems_chain_extract (&r_chain->next_fd); rtems_chain_extract (&r_chain->next_fd);
rtems_aio_remove_fd (r_chain); rtems_aio_remove_fd (r_chain);
@@ -84,8 +88,7 @@ int aio_cancel(int fildes, struct aiocb *aiocbp)
} }
else else
{ {
if (aiocbp->aio_fildes != fildes) if (aiocbp->aio_fildes != fildes) {
{
pthread_mutex_unlock (&aio_request_queue.mutex); pthread_mutex_unlock (&aio_request_queue.mutex);
rtems_set_errno_and_return_minus_one (EINVAL); rtems_set_errno_and_return_minus_one (EINVAL);
} }
@@ -120,5 +123,4 @@ int aio_cancel(int fildes, struct aiocb *aiocbp)
} }
return AIO_ALLDONE; return AIO_ALLDONE;
} }