kernel/fs: Return B_BAD_VALUE for O_RDONLY|O_TRUNC on open().
According to Sortix os-test, this better matches the behavior of OpenBSD and other OSes that reject this combination of flags.
This commit is contained in:
@@ -5410,7 +5410,7 @@ check_open_mode(struct vnode* vnode, int openMode)
|
||||
if ((openMode & O_RDWR) != 0 && (openMode & O_WRONLY) != 0)
|
||||
return B_BAD_VALUE;
|
||||
if ((openMode & O_RWMASK) == O_RDONLY && (openMode & O_TRUNC) != 0)
|
||||
return B_NOT_ALLOWED;
|
||||
return B_BAD_VALUE;
|
||||
|
||||
if ((openMode & O_NOFOLLOW) != 0 && S_ISLNK(vnode->Type()))
|
||||
return B_LINK_LIMIT;
|
||||
|
||||
Reference in New Issue
Block a user