mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:24:57 +00:00
Userland: Allow our access check to pass flags to faccessat syscall
This commit is contained in:
parent
639aee037f
commit
059904371f
4 changed files with 8 additions and 7 deletions
|
@ -359,14 +359,14 @@ ErrorOr<void> link_file(StringView destination_path, StringView source_path)
|
|||
return TRY(Core::System::symlink(source_path, TRY(get_duplicate_file_name(destination_path))));
|
||||
}
|
||||
|
||||
ErrorOr<String> resolve_executable_from_environment(StringView filename)
|
||||
ErrorOr<String> resolve_executable_from_environment(StringView filename, int flags)
|
||||
{
|
||||
if (filename.is_empty())
|
||||
return Error::from_errno(ENOENT);
|
||||
|
||||
// Paths that aren't just a file name generally count as already resolved.
|
||||
if (filename.contains('/')) {
|
||||
TRY(Core::System::access(filename, X_OK));
|
||||
TRY(Core::System::access(filename, X_OK, flags));
|
||||
return TRY(String::from_utf8(filename));
|
||||
}
|
||||
|
||||
|
@ -382,7 +382,7 @@ ErrorOr<String> resolve_executable_from_environment(StringView filename)
|
|||
for (auto directory : directories) {
|
||||
auto file = TRY(String::formatted("{}/{}", directory, filename));
|
||||
|
||||
if (!Core::System::access(file, X_OK).is_error())
|
||||
if (!Core::System::access(file, X_OK, flags).is_error())
|
||||
return file;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ bool can_delete_or_move(StringView path);
|
|||
ErrorOr<String> read_link(StringView link_path);
|
||||
ErrorOr<void> link_file(StringView destination_path, StringView source_path);
|
||||
|
||||
ErrorOr<String> resolve_executable_from_environment(StringView filename);
|
||||
ErrorOr<String> resolve_executable_from_environment(StringView filename, int flags = 0);
|
||||
bool looks_like_shared_library(StringView path);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue