From 561587c11c5384f4030bf2e858418f9dedabf786 Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Fri, 9 Aug 2024 15:58:23 +0700 Subject: [PATCH] fix(vfs): fix nullfs open syscall --- components/vfs/nullfs.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/vfs/nullfs.c b/components/vfs/nullfs.c index 1324052a5d..8ac166d2dc 100644 --- a/components/vfs/nullfs.c +++ b/components/vfs/nullfs.c @@ -204,12 +204,13 @@ static int vfs_null_open(const char* path, int flags, int mode) return -1; } - if (flags & O_RDWR) { + int acc_mode = flags & O_ACCMODE; + if (acc_mode == O_RDWR) { SET_READABLE(g_fds, fd); SET_WRITABLE(g_fds, fd); - } else if (flags & O_WRONLY) { + } else if (acc_mode == O_WRONLY) { SET_WRITABLE(g_fds, fd); - } else if (flags & O_RDONLY) { + } else if (acc_mode == O_RDONLY) { SET_READABLE(g_fds, fd); } else { errno = EINVAL;