mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-08 09:35:15 +00:00
Kernel+LibC: Add O_EXEC, move exec permission checking to VFS::open()
O_EXEC is mentioned by POSIX, so let's have it. Currently, it is only used inside the kernel to ensure the process has the right permissions when opening an executable.
This commit is contained in:
committed by
Andreas Kling
parent
4566c2d811
commit
2fcbb846fb
@@ -653,15 +653,12 @@ int Process::do_exec(String path, Vector<String> arguments, Vector<String> envir
|
||||
if (parts.is_empty())
|
||||
return -ENOENT;
|
||||
|
||||
auto result = VFS::the().open(path, 0, 0, current_directory());
|
||||
auto result = VFS::the().open(path, O_EXEC, 0, current_directory());
|
||||
if (result.is_error())
|
||||
return result.error();
|
||||
auto description = result.value();
|
||||
auto metadata = description->metadata();
|
||||
|
||||
if (!metadata.may_execute(*this))
|
||||
return -EACCES;
|
||||
|
||||
if (!metadata.size)
|
||||
return -ENOTIMPL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user