1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:17:36 +00:00

Kernel: Stop allowing implicit conversion from KResult to int

This patch removes KResult::operator int() and deals with the fallout.
This forces a lot of code to be more explicit in its handling of errors,
greatly improving readability.
This commit is contained in:
Andreas Kling 2021-08-14 15:15:11 +02:00
parent d30d776ca4
commit 7676edfb9b
14 changed files with 51 additions and 52 deletions

View file

@ -19,10 +19,10 @@ KResultOr<FlatPtr> Process::sys$fstat(int fd, Userspace<stat*> user_statbuf)
if (!description)
return EBADF;
stat buffer = {};
int rc = description->stat(buffer);
auto result = description->stat(buffer);
if (!copy_to_user(user_statbuf, &buffer))
return EFAULT;
return rc;
return result;
}
KResultOr<FlatPtr> Process::sys$stat(Userspace<const Syscall::SC_stat_params*> user_params)