From 9ab0d4c56f95370a7b151ecb99d08df1241eb18e Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 24 Feb 2015 07:29:47 -0600 Subject: [PATCH] fs/aio: Corrrect some backward tests in aio_read() and aio_write(): Socket descriptors have higher numbers than file descriptors. In aio_contain(), Copy u.ptr (void *) when initializing aioc and not the case specific u.aioc_filep. From Michal Ulianko. --- fs/aio/aio_read.c | 2 +- fs/aio/aio_write.c | 2 +- fs/aio/aioc_contain.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/aio/aio_read.c b/fs/aio/aio_read.c index fd05edbc6b8..81ee4e59263 100644 --- a/fs/aio/aio_read.c +++ b/fs/aio/aio_read.c @@ -111,7 +111,7 @@ static void aio_read_worker(FAR void *arg) aiocbp = aioc_decant(aioc); #if defined(AIO_HAVE_FILEP) && defined(AIO_HAVE_PSOCK) - if (aiocbp->aio_fildes >= CONFIG_NFILE_DESCRIPTORS) + if (aiocbp->aio_fildes < CONFIG_NFILE_DESCRIPTORS) #endif #ifdef AIO_HAVE_FILEP { diff --git a/fs/aio/aio_write.c b/fs/aio/aio_write.c index 6b890389505..70f40ca5989 100644 --- a/fs/aio/aio_write.c +++ b/fs/aio/aio_write.c @@ -131,7 +131,7 @@ static void aio_write_worker(FAR void *arg) aiocbp = aioc_decant(aioc); #if defined(AIO_HAVE_FILEP) && defined(AIO_HAVE_PSOCK) - if (aiocbp->aio_fildes >= CONFIG_NFILE_DESCRIPTORS) + if (aiocbp->aio_fildes < CONFIG_NFILE_DESCRIPTORS) #endif #ifdef AIO_HAVE_FILEP { diff --git a/fs/aio/aioc_contain.c b/fs/aio/aioc_contain.c index 54f5dcd3d66..207ae74681d 100644 --- a/fs/aio/aioc_contain.c +++ b/fs/aio/aioc_contain.c @@ -107,7 +107,7 @@ FAR struct aio_container_s *aio_contain(FAR struct aiocb *aiocbp) #endif #if defined(AIO_HAVE_FILEP) && defined(AIO_HAVE_PSOCK) - if (aiocbp->aio_fildes >= CONFIG_NFILE_DESCRIPTORS) + if (aiocbp->aio_fildes < CONFIG_NFILE_DESCRIPTORS) #endif #ifdef AIO_HAVE_FILEP { @@ -151,7 +151,7 @@ FAR struct aio_container_s *aio_contain(FAR struct aiocb *aiocbp) memset(aioc, 0, sizeof(struct aio_container_s)); aioc->aioc_aiocbp = aiocbp; - aioc->u.aioc_filep = u.ptr; + aioc->u.ptr = u.ptr; aioc->aioc_pid = getpid(); #ifdef CONFIG_PRIORITY_INHERITANCE