libc: Fix execvp() calling the shell after an ENOEXEC
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
apio 2023-06-03 17:00:24 +02:00
parent 6ad7491300
commit 6b4d41529e
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -42,7 +42,8 @@ static Result<int> try_execvpe(const char* name, char* const* argv, char* const*
{ {
Vector<char*> shell_argv; Vector<char*> shell_argv;
TRY(shell_argv.try_append(const_cast<char*>("sh"))); TRY(shell_argv.try_append(const_cast<char*>("sh")));
char* const* arg = argv; TRY(shell_argv.try_append(file.mutable_data()));
char* const* arg = argv + 1;
do { do {
TRY(shell_argv.try_append(*arg)); TRY(shell_argv.try_append(*arg));
} while (*(arg++)); } while (*(arg++));