1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

Kernel: Make O_RDONLY non-zero

Sergey suggested that having a non-zero O_RDONLY would make some things
less confusing, and it seems like he's right about that.

We can now easily check read/write permissions separately instead of
dancing around with the bits.

This patch also fixes unveil() validation for O_RDWR which previously
forgot to check for "r" permission.
This commit is contained in:
Andreas Kling 2020-01-21 13:14:26 +01:00
parent efbd1620d9
commit 6081c76515
6 changed files with 24 additions and 33 deletions

View file

@ -1945,9 +1945,9 @@ int Process::sys$open(const Syscall::SC_open_params* user_params)
if (options & O_UNLINK_INTERNAL)
return -EINVAL;
if ((options & O_RDWR) || (options & O_WRONLY))
if (options & O_WRONLY)
REQUIRE_PROMISE(wpath);
else
else if (options & O_RDONLY)
REQUIRE_PROMISE(rpath);
if (options & O_CREAT)