From: Denys Vlasenko Date: Thu, 23 Jun 2011 20:06:39 +0000 (+0200) Subject: Remove dead "ifndef CLONE_PTRACE" branch X-Git-Tag: v4.7~349 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=47247865eb108e5f5c9cb1f0c3f40fd97cdb0978;p=strace Remove dead "ifndef CLONE_PTRACE" branch 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 --- diff --git a/process.c b/process.c index c16e93f4..09200e92 100644 --- 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,