From 6b4d41529edd166886abe1f1d4c5410b9ea79737 Mon Sep 17 00:00:00 2001 From: apio Date: Sat, 3 Jun 2023 17:00:24 +0200 Subject: [PATCH] libc: Fix execvp() calling the shell after an ENOEXEC --- libc/src/unistd.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libc/src/unistd.cpp b/libc/src/unistd.cpp index 9b871136..66115a62 100644 --- a/libc/src/unistd.cpp +++ b/libc/src/unistd.cpp @@ -42,7 +42,8 @@ static Result try_execvpe(const char* name, char* const* argv, char* const* { Vector shell_argv; TRY(shell_argv.try_append(const_cast("sh"))); - char* const* arg = argv; + TRY(shell_argv.try_append(file.mutable_data())); + char* const* arg = argv + 1; do { TRY(shell_argv.try_append(*arg)); } while (*(arg++));