]> granicus.if.org Git - strace/commitdiff
Remove dead "ifndef CLONE_PTRACE" branch
authorDenys Vlasenko <dvlasenk@redhat.com>
Thu, 23 Jun 2011 20:06:39 +0000 (22:06 +0200)
committerDenys Vlasenko <dvlasenk@redhat.com>
Thu, 23 Jun 2011 20:06:39 +0000 (22:06 +0200)
process.c defines CLONE_PTRACE for Linux, so it can't be undefined.
Therefore ifndef CLONE_PTRACE code is dead (since at least 2004).
This patch removes it.

* process.c (handle_new_child): Remove ifdef CLONE_PTRACE/endif (but not
  the code inside) and entire ifndef CLONE_PTRACE/endif block.

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

index c16e93f4291b0adb3644513fe71ff4e971eb7b53..09200e9245a8cd9b876bf7f458f184d21a467b70 100644 (file)
--- a/process.c
+++ b/process.c
@@ -780,7 +780,6 @@ handle_new_child(struct tcb *tcp, int pid, int bpt)
 {
        struct tcb *tcpchild;
 
-#ifdef CLONE_PTRACE            /* See new setbpt code.  */
        tcpchild = pid2tcb(pid);
        if (tcpchild != NULL) {
                /* The child already reported its startup trap
@@ -792,30 +791,15 @@ handle_new_child(struct tcb *tcp, int pid, int bpt)
 [preattached child %d of %d in weird state!]\n",
                                pid, tcp->pid);
        }
-       else
-#endif /* CLONE_PTRACE */
-       {
+       else {
                tcpchild = alloctcb(pid);
        }
 
-#ifndef CLONE_PTRACE
-       /* Attach to the new child */
-       if (ptrace(PTRACE_ATTACH, pid, (char *) 1, 0) < 0) {
-               if (bpt)
-                       clearbpt(tcp);
-               perror("PTRACE_ATTACH");
-               fprintf(stderr, "Too late?\n");
-               droptcb(tcpchild);
-               return 0;
-       }
-#endif /* !CLONE_PTRACE */
-
-       if (bpt)
-               clearbpt(tcp);
-
        tcpchild->flags |= TCB_ATTACHED;
-       /* Child has BPT too, must be removed on first occasion.  */
+
        if (bpt) {
+               clearbpt(tcp);
+               /* Child has BPT too, must be removed on first occasion.  */
                tcpchild->flags |= TCB_BPTSET;
                tcpchild->baddr = tcp->baddr;
                memcpy(tcpchild->inst, tcp->inst,