fs_open: return EROFS for non-RO opens
The use of EACCES leads to slightly confusing error messages in downstream consumers, so prefer EROFS to better articulate what's actually happening. While here, use O_RDWR to mask the open flags while testing for non-RO access. This is at least encouraged by POSIX with their suggestion that "O_RDONLY | O_WRONLY == O_RDWR".
This commit is contained in:
parent
ffb2658abb
commit
72d15ab6c7
|
@ -95,8 +95,8 @@ static int fs_open(const char *path, struct fuse_file_info *fi)
|
|||
if (!link) {
|
||||
return -ENOENT;
|
||||
}
|
||||
if ((fi->flags & 3) != O_RDONLY) {
|
||||
return -EACCES;
|
||||
if ((fi->flags & O_RDWR) != O_RDONLY) {
|
||||
return -EROFS;
|
||||
}
|
||||
if (CACHE_SYSTEM_INIT) {
|
||||
fi->fh = (uint64_t) Cache_open(path);
|
||||
|
|
Loading…
Reference in New Issue