]> granicus.if.org Git - strace/commitdiff
ptrace_restart: do not print diagnostics when ptrace returns ESRCH
authorEugene Syromyatnikov <evgsyr@gmail.com>
Sun, 10 Feb 2019 23:57:38 +0000 (00:57 +0100)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 11 Feb 2019 10:49:50 +0000 (10:49 +0000)
After some discussion, it was decided that the situation
when the tracee is gone does not worth reporting.

* strace.c (ptrace_restart): Return early if ptrace returned ESRCH.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1662936

strace.c

index e083cc3c27ac2c2dc203b4eb0093224921203650..ce89d5cdeec97a61dd479a107dd37862a9178835 100644 (file)
--- a/strace.c
+++ b/strace.c
@@ -366,7 +366,7 @@ ptrace_restart(const unsigned int op, struct tcb *const tcp, unsigned int sig)
        errno = 0;
        ptrace(op, tcp->pid, 0L, (unsigned long) sig);
        err = errno;
-       if (!err)
+       if (!err || err == ESRCH)
                return 0;
 
        /*
@@ -383,8 +383,6 @@ ptrace_restart(const unsigned int op, struct tcb *const tcp, unsigned int sig)
                        tcp->pid, ptrace_op_str(op), strerror(err));
                line_ended();
        }
-       if (err == ESRCH)
-               return 0;
        errno = err;
        perror_msg("ptrace(%s,pid:%d,sig:%u)",
                   ptrace_op_str(op), tcp->pid, sig);