From 1466a9e2b6c1c89a182244c7b389de21ef1765aa Mon Sep 17 00:00:00 2001 From: guoshichao Date: Fri, 30 Jun 2023 14:20:44 +0800 Subject: [PATCH] libs/libc/aio: refactor the fd flags check procedure 1. make the implementation compatible with c89 Signed-off-by: guoshichao --- fs/aio/aio_write.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/aio/aio_write.c b/fs/aio/aio_write.c index 803bbdfa1c..829d1de019 100644 --- a/fs/aio/aio_write.c +++ b/fs/aio/aio_write.c @@ -246,6 +246,7 @@ int aio_write(FAR struct aiocb *aiocbp) { FAR struct aio_container_s *aioc; int ret; + int flags; DEBUGASSERT(aiocbp); @@ -276,8 +277,8 @@ int aio_write(FAR struct aiocb *aiocbp) * the EBADF error code */ - int flags = fcntl(aiocbp->aio_fildes, F_GETFL); - if (!(flags & O_WRONLY)) + flags = fcntl(aiocbp->aio_fildes, F_GETFL); + if ((flags & O_WRONLY) == 0) { aiocbp->aio_result = -EBADF; return OK;