mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 03:09:08 +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
@@ -215,6 +215,10 @@ KResultOr<NonnullRefPtr<FileDescription>> VFS::open(StringView path, int options
|
||||
return KResult(-EISDIR);
|
||||
should_truncate_file = options & O_TRUNC;
|
||||
}
|
||||
if (options & O_EXEC) {
|
||||
if (!metadata.may_execute(current->process()))
|
||||
return KResult(-EACCES);
|
||||
}
|
||||
|
||||
if (metadata.is_device()) {
|
||||
auto device = Device::get_device(metadata.major_device, metadata.minor_device);
|
||||
|
||||
Reference in New Issue
Block a user