wait for new children to stop before assuming they have stopped
diff --git a/sysdeps/linux-gnu/trace.c b/sysdeps/linux-gnu/trace.c
index a90d46a..fc2780b 100644
--- a/sysdeps/linux-gnu/trace.c
+++ b/sysdeps/linux-gnu/trace.c
@@ -173,6 +173,15 @@
return -1;
}
+ /* man ptrace: PTRACE_ATTACH attaches to the process specified
+ in pid. The child is sent a SIGSTOP, but will not
+ necessarily have stopped by the completion of this call;
+ use wait() to wait for the child to stop. */
+ if (waitpid (pid, NULL, 0) != pid) {
+ perror ("trace_pid: waitpid");
+ exit (1);
+ }
+
return 0;
}