Fix access mode check in open() call

This commit is contained in:
Marcus Holland-Moritz 2023-07-01 14:46:32 +02:00
parent e6dc6731e7
commit c3de719134

View File

@ -466,7 +466,8 @@ int op_open_common(LogProxy& log_, dwarfs_userdata* userdata,
if (entry) {
if (entry->is_directory()) {
err = EISDIR;
} else if (fi->flags & (O_APPEND | O_CREAT | O_TRUNC)) {
} else if ((fi->flags & O_ACCMODE) != O_RDONLY ||
(fi->flags & (O_APPEND | O_TRUNC)) != 0) {
err = EACCES;
} else {
fi->fh = entry->inode_num();