1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-21 15:45:07 +00:00

Kernel: Make Inode::directory_entry_count errors observable.

Certain implementations of Inode::directory_entry_count were calling
functions which returned errors, but had no way of surfacing them.
Switch the return type to KResultOr<size_t> and start observing these
error paths.
This commit is contained in:
Brian Gianforcaro 2020-08-05 01:00:18 -07:00 committed by Andreas Kling
parent 7490ea9449
commit e8c9b5e870
12 changed files with 29 additions and 17 deletions

View file

@ -731,7 +731,11 @@ KResult VFS::rmdir(StringView path, Custody& base)
if (!parent_inode.metadata().may_write(*Process::current()))
return KResult(-EACCES);
if (inode.directory_entry_count() != 2)
KResultOr<size_t> dir_count_result = inode.directory_entry_count();
if (dir_count_result.is_error())
return dir_count_result.result();
if (dir_count_result.value() != 2)
return KResult(-ENOTEMPTY);
if (custody.is_readonly())