mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +00:00
Kernel: Make file description lookup return KResultOr
Instead of checking it at every call site (to generate EBADF), we make file_description(fd) return a KResultOr<NonnullRefPtr<FileDescription>>. This allows us to wrap all the calls in TRY(). :^) The only place that got a little bit messier from this is sys$mount(), and there's a whole bunch of things there in need of cleanup.
This commit is contained in:
@@ -79,9 +79,7 @@ KResultOr<NonnullRefPtr<Inode>> Process::lookup_stacks_directory(const ProcFS& p
|
||||
|
||||
KResultOr<size_t> Process::procfs_get_file_description_link(unsigned fd, KBufferBuilder& builder) const
|
||||
{
|
||||
auto file_description = m_fds.file_description(fd);
|
||||
if (!file_description)
|
||||
return EBADF;
|
||||
auto file_description = TRY(m_fds.file_description(fd));
|
||||
auto data = file_description->absolute_path();
|
||||
builder.append(data);
|
||||
return data.length();
|
||||
|
||||
Reference in New Issue
Block a user