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:
Augustin Cavalier
2026-01-29 15:24:03 -05:00
parent 6fc8d99e21
commit 18dd362efa
+1 -1
View File
@@ -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;