summaryrefslogtreecommitdiff
path: root/internal/namespace/launcher_src/launcher.c
diff options
context:
space:
mode:
Diffstat (limited to 'internal/namespace/launcher_src/launcher.c')
-rw-r--r--internal/namespace/launcher_src/launcher.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/internal/namespace/launcher_src/launcher.c b/internal/namespace/launcher_src/launcher.c
index 63dd6ff..4311430 100644
--- a/internal/namespace/launcher_src/launcher.c
+++ b/internal/namespace/launcher_src/launcher.c
@@ -65,12 +65,15 @@ int main(int argc, char **argv) {
// as the first element of the argv array.
// Therefore, argv[0] is the path to the binary we want to execute.
if (argv[0] == NULL) {
- fprintf(stderr, "No target binary provided in argv[0]\n");
+ fprintf(stderr, "No target binary provided in argv[0]\\n");
return 1;
}
- // Use execv instead of execvp to avoid PATH search issues
- // since we are providing an absolute path from Go.
+ // Prepare a new argv for the target command.
+ // We want the target binary to see itself as argv[0].
+ // The current argv is [target_binary, arg1, arg2, ...].
+ // execv expects argv[0] to be the filename, and the rest as arguments.
+ // This is already the case here, but let's be explicit.
if (execv(argv[0], argv) == -1) {
perror("execv failed");
return 1;