libs/libc/aio: refactor the fd flags check procedure
1. make the implementation compatible with c89 Signed-off-by: guoshichao <guoshichao@xiaomi.com>
This commit is contained in:
parent
5af99c65de
commit
1466a9e2b6
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user