From 6c60c7df075dc5330d2d52ee981b67ff2ea9a495 Mon Sep 17 00:00:00 2001 From: guoshichao Date: Thu, 8 Jun 2023 19:18:23 +0800 Subject: [PATCH] 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 --- libs/libc/aio/aio_error.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libs/libc/aio/aio_error.c b/libs/libc/aio/aio_error.c index 64404d346e..f0d3268399 100644 --- a/libs/libc/aio/aio_error.c +++ b/libs/libc/aio/aio_error.c @@ -89,6 +89,13 @@ int aio_error(FAR const struct aiocb *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) { return -aiocbp->aio_result;