-b execve: avoid misleading warning about unknown pid
* strace.c (maybe_allocate_tcb): If detach_on_execve is set, do not warn
about !WIFSTOPPED process with pid == strace_child.
* tests/bexecve.test: New test.
* tests/Makefile.am (TESTS): Add it.
diff --git a/strace.c b/strace.c
index 7e5a3e0..1eaa2b9 100644
--- a/strace.c
+++ b/strace.c
@@ -2080,9 +2080,14 @@
maybe_allocate_tcb(const int pid, const int status)
{
if (!WIFSTOPPED(status)) {
+ if (detach_on_execve && pid == strace_child) {
+ /* example: strace -bexecve sh -c 'exec true' */
+ strace_child = 0;
+ return NULL;
+ }
/*
* This can happen if we inherited an unknown child.
- * Example: (sleep 1 & exec strace sleep 2)
+ * Example: (sleep 1 & exec strace true)
*/
error_msg("Exit of unknown pid %u ignored", pid);
return NULL;