libs/libc/aio: fix aio_error compatible bug

1. make the aio_error implementation can pass the
ltp/open_posix_testsuite/aio_error testcases
2. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/aio_error.html

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
This commit is contained in:
guoshichao 2023-06-08 19:18:23 +08:00 committed by Alan Carvalho de Assis
parent 31a2c22112
commit 6c60c7df07

View File

@ -89,6 +89,13 @@ int aio_error(FAR const struct aiocb *aiocbp)
{ {
DEBUGASSERT(aiocbp); DEBUGASSERT(aiocbp);
/* the aio_reqprio field must be large or equal than 0 */
if (aiocbp->aio_reqprio < 0)
{
return EINVAL;
}
if (aiocbp->aio_result < 0) if (aiocbp->aio_result < 0)
{ {
return -aiocbp->aio_result; return -aiocbp->aio_result;