wait_for_proc may fail, and should simply waitpid instead of ptracing
- which means that we need to continue the process after starting it,
the same as we do when attaching
diff --git a/execute_program.c b/execute_program.c
index 859f32c..55df205 100644
--- a/execute_program.c
+++ b/execute_program.c
@@ -78,6 +78,7 @@
pid = fork();
if (pid < 0) {
+ fail:
perror("ltrace: fork");
exit(1);
} else if (!pid) { /* child */
@@ -89,9 +90,9 @@
_exit(1);
}
- wait_for_proc(pid);
+ if (wait_for_proc(pid) < 0)
+ goto fail;
debug(1, "PID=%d", pid);
-
return pid;
}