]> granicus.if.org Git - strace/commitdiff
Eat pending SIGSTOP _before_ PTRACE_DETACH in detach()
authorDenys Vlasenko <dvlasenk@redhat.com>
Fri, 21 Jun 2013 13:50:41 +0000 (15:50 +0200)
committerDenys Vlasenko <dvlasenk@redhat.com>
Fri, 21 Jun 2013 13:50:41 +0000 (15:50 +0200)
* strace.c (detach): If TCB_IGNORE_ONE_SIGSTOP is set,
di not PTRACE_DETACH - wait for SIGSTOP first.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
strace.c

index 89e89bc3a534695a6e4a20a5a2da98a123b0d385..55089bf3be744b755110a67dc5e8eb417200910d 100644 (file)
--- a/strace.c
+++ b/strace.c
@@ -758,6 +758,8 @@ detach(struct tcb *tcp)
                 * would be left stopped (process state T).
                 */
                sigstop_expected = (tcp->flags & TCB_IGNORE_ONE_SIGSTOP);
+               if (sigstop_expected)
+                       goto wait_loop;
                error = ptrace(PTRACE_DETACH, tcp->pid, 0, 0);
                if (error == 0) {
                        /* On a clear day, you can see forever. */
@@ -802,6 +804,7 @@ detach(struct tcb *tcp)
        }
 
        if (sigstop_expected || interrupt_done) {
+ wait_loop:
                for (;;) {
                        int sig;
                        if (waitpid(tcp->pid, &status, __WALL) < 0) {