mirror of
https://github.com/apache/nuttx.git
synced 2026-10-12 08:40:20 +00:00
libs/libc/aio: fix aio_return compatible bug
1. make the aio_return implementation can pass the ltp/open_posix_testsuite/aio_return testcases 2. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/aio_return.html Signed-off-by: guoshichao <guoshichao@xiaomi.com>
This commit is contained in:
parent
d08b81db9d
commit
0d9e7be323
1 changed files with 11 additions and 1 deletions
|
|
@ -91,6 +91,8 @@
|
|||
|
||||
ssize_t aio_return(FAR struct aiocb *aiocbp)
|
||||
{
|
||||
ssize_t ret;
|
||||
|
||||
DEBUGASSERT(aiocbp);
|
||||
if (aiocbp->aio_result < 0)
|
||||
{
|
||||
|
|
@ -98,7 +100,15 @@ ssize_t aio_return(FAR struct aiocb *aiocbp)
|
|||
return (ssize_t)ERROR;
|
||||
}
|
||||
|
||||
return aiocbp->aio_result;
|
||||
ret = aiocbp->aio_result;
|
||||
|
||||
/* the aio_return function may be called exactly only once, thereafter, if
|
||||
* the same aiocbp structure is used in a call to aio_return, then error
|
||||
* may be returned
|
||||
*/
|
||||
|
||||
aiocbp->aio_result = -EINVAL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_FS_AIO */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue