pkarashchenko commented on code in PR #9640: URL: https://github.com/apache/nuttx/pull/9640#discussion_r1245598376
########## fs/aio/aio_write.c: ########## @@ -249,6 +249,40 @@ int aio_write(FAR struct aiocb *aiocbp) DEBUGASSERT(aiocbp); + if (aiocbp->aio_reqprio < 0) + { + set_errno(EINVAL); + return ERROR; + } + + if (aiocbp->aio_offset < 0) + { + aiocbp->aio_result = -EINVAL; + return OK; + } + + if (aiocbp->aio_fildes < 0) + { + /* for EBADF, the aio_write do not return error directly, but using + * aio_error to return this error code + */ + + aiocbp->aio_result = -EBADF; + return OK; + } + + /* the aio_fildes that transferred in may be opened with O_RDONLY, for this + * case, we need to return OK directly, and using the aio_error to collect + * the EBADF error code + */ + + int flags = fcntl(aiocbp->aio_fildes, F_GETFL); Review Comment: C89 incompatible ########## fs/aio/aio_write.c: ########## @@ -249,6 +249,40 @@ int aio_write(FAR struct aiocb *aiocbp) DEBUGASSERT(aiocbp); + if (aiocbp->aio_reqprio < 0) + { + set_errno(EINVAL); + return ERROR; + } + + if (aiocbp->aio_offset < 0) + { + aiocbp->aio_result = -EINVAL; + return OK; + } + + if (aiocbp->aio_fildes < 0) + { + /* for EBADF, the aio_write do not return error directly, but using + * aio_error to return this error code + */ + + aiocbp->aio_result = -EBADF; + return OK; + } + + /* the aio_fildes that transferred in may be opened with O_RDONLY, for this + * case, we need to return OK directly, and using the aio_error to collect + * the EBADF error code + */ + + int flags = fcntl(aiocbp->aio_fildes, F_GETFL); + if (!(flags & O_WRONLY)) Review Comment: Optional ```suggestion if ((flags & O_WRONLY) == 0) ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org