From e5bbb969a15c569cf7d37634234a71783f628390 Mon Sep 17 00:00:00 2001 From: James O'Doherty Date: Fri, 22 May 2026 11:37:57 -0400 Subject: Fix PID lifecycle race and improve CLI routing for diagnostic commands --- internal/namespace/launcher_src/launcher.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'internal/namespace/launcher_src') 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; -- cgit v1.2.3