aboutsummaryrefslogtreecommitdiff
path: root/execute_program.c
diff options
context:
space:
mode:
authorPetr Machata <pmachata@redhat.com>2012-03-02 00:10:37 +0100
committerPetr Machata <pmachata@redhat.com>2012-04-19 01:12:50 +0200
commitc805c624d4cd23674bbc18f9d0f97c5d8dcdff7c (patch)
tree8560d40ada7f1e5fb5c7caa17696c1b2474f876b /execute_program.c
parent29add4fdf852b10ddd22cac0d1390f6d01577bc2 (diff)
downloadltrace-c805c624d4cd23674bbc18f9d0f97c5d8dcdff7c.tar.gz
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
Diffstat (limited to 'execute_program.c')
-rw-r--r--execute_program.c5
1 files changed, 3 insertions, 2 deletions
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 @@ execute_program(const char * command, char **argv)
pid = fork();
if (pid < 0) {
+ fail:
perror("ltrace: fork");
exit(1);
} else if (!pid) { /* child */
@@ -89,9 +90,9 @@ execute_program(const char * command, char **argv)
_exit(1);
}
- wait_for_proc(pid);
+ if (wait_for_proc(pid) < 0)
+ goto fail;
debug(1, "PID=%d", pid);
-
return pid;
}