mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:07:35 +00:00
UserspaceEmulator: Correctly fail in execve when binary is inaccessible
Previously, Emulator::virt$execve would not report ENOENT and EACCES when the binary to be executed was nonexistent or not executable. This broke the execp family of functions, which rely on ENOENT being reported in order to know that they should continue searching $PATH.
This commit is contained in:
parent
d2f99c200f
commit
5b2c973cc3
1 changed files with 5 additions and 0 deletions
|
@ -1225,6 +1225,11 @@ int Emulator::virt$execve(FlatPtr params_addr)
|
|||
for (auto& argument : arguments)
|
||||
reportln("=={}== - {}", getpid(), argument);
|
||||
|
||||
if (access(path.characters(), X_OK) < 0) {
|
||||
if (errno == ENOENT || errno == EACCES)
|
||||
return -errno;
|
||||
}
|
||||
|
||||
Vector<char*> argv;
|
||||
Vector<char*> envp;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue