kernel: Disallow passing O_WRONLY and O_DIRECTORY at the same time
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
apio 2023-05-05 18:53:50 +02:00
parent 349ba0acb1
commit 9184bbfef6
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -23,7 +23,10 @@ Result<u64> sys_openat(Registers*, SyscallArgs args)
// Caller did not pass either O_RDONLY, O_WRONLY or O_RDWR // Caller did not pass either O_RDONLY, O_WRONLY or O_RDWR
if ((flags & O_RDWR) == 0) { return err(EINVAL); } if ((flags & O_RDWR) == 0) { return err(EINVAL); }
if ((flags & O_DIRECTORY) & (flags & O_CREAT)) return err(EINVAL); if (flags & O_DIRECTORY)
{
if ((flags & O_WRONLY) || (flags & O_CREAT)) return err(EINVAL);
}
int error; int error;
SharedPtr<VFS::Inode> parent_inode; SharedPtr<VFS::Inode> parent_inode;