summaryrefslogtreecommitdiff
path: root/strace.c
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2013-06-21 16:19:46 +0200
committerDenys Vlasenko <dvlasenk@redhat.com>2013-06-21 16:19:46 +0200
commit71d3d29a9d51add731c07e328a7394db0b3dd212 (patch)
treefcf805aa61cf725f6c00efddc85d0c989ae0b4ca /strace.c
parente2567d54dd57438d8ebe0167748cde7b661103e8 (diff)
downloadstrace-71d3d29a9d51add731c07e328a7394db0b3dd212.tar.gz
strace-71d3d29a9d51add731c07e328a7394db0b3dd212.tar.bz2
strace-71d3d29a9d51add731c07e328a7394db0b3dd212.tar.xz
Panic a bit less when we see an unknown pid
I stumbeld over this case when I used "exec stace ...". * strace.c (trace): Do not exit if we see an unknown pid in wait4. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'strace.c')
-rw-r--r--strace.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/strace.c b/strace.c
index 6e9ea91..ab971b5 100644
--- a/strace.c
+++ b/strace.c
@@ -2055,10 +2055,17 @@ trace(void)
pid);
} else {
/* This can happen if a clone call used
- CLONE_PTRACE itself. */
- if (WIFSTOPPED(status))
+ * CLONE_PTRACE itself, or if we inherited
+ * an unknown child. Example:
+ * (sleep 1 & exec strace sleep 2)
+ */
+ if (WIFSTOPPED(status)) {
ptrace(PTRACE_CONT, pid, (char *) 0, 0);
- error_msg_and_die("Unknown pid: %u", pid);
+ error_msg("Stop of unknown pid %u seen, PTRACE_CONTed it", pid);
+ } else {
+ error_msg("Exit of unknown pid %u seen", pid);
+ }
+ continue;
}
}