diff options
| author | Troy <[email protected]> | 2024-03-27 20:32:59 +0800 |
|---|---|---|
| committer | Meco Man <[email protected]> | 2024-04-16 22:29:47 -0400 |
| commit | 8881f0eea17229affb031205f90dc1007194d61b (patch) | |
| tree | 5b0f2c83421d7b81dc14d3fba9fb930610f5eb95 | |
| parent | 140585364d07d8709312e66a54054600cbf0a9a1 (diff) | |
Fix the issue of incorrect return of invalid parameters in aio_write
| -rw-r--r-- | components/libc/posix/io/aio/aio.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/components/libc/posix/io/aio/aio.c b/components/libc/posix/io/aio/aio.c index b1d443b334..a6d8acab09 100644 --- a/components/libc/posix/io/aio/aio.c +++ b/components/libc/posix/io/aio/aio.c @@ -7,6 +7,7 @@ * Date Author Notes * 2017/12/30 Bernard The first version. * 2024/03/26 TroyMitchelle Added some function comments + * 2024/03/27 TroyMitchelle Fix the issue of incorrect return of invalid parameters in aio_write */ #include <rtthread.h> @@ -401,7 +402,8 @@ int aio_write(struct aiocb *cb) /* check access mode */ oflags = fcntl(cb->aio_fildes, F_GETFL, 0); - if ((oflags & O_ACCMODE) != O_WRONLY || + /* If the flag is not in write only or read-write mode, it cannot be written then an invalid parameter is returned */ + if ((oflags & O_ACCMODE) != O_WRONLY && (oflags & O_ACCMODE) != O_RDWR) return -EINVAL; |
