From 179063d63c4e1f49dd863db7ec5d70a3fa2a3713 Mon Sep 17 00:00:00 2001 From: Eugene Syromyatnikov Date: Mon, 11 Feb 2019 00:57:38 +0100 Subject: [PATCH 21/27] ptrace_restart: do not print diagnostics when ptrace returns ESRCH 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 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/strace.c b/strace.c index f2aa846..0745838 100644 --- a/strace.c +++ b/strace.c @@ -353,7 +353,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; switch (op) { @@ -384,8 +384,6 @@ ptrace_restart(const unsigned int op, struct tcb *const tcp, unsigned int sig) tcp->pid, msg, strerror(err)); line_ended(); } - if (err == ESRCH) - return 0; errno = err; perror_msg("ptrace(PTRACE_%s,pid:%d,sig:%u)", msg, tcp->pid, sig); return -1; -- 2.1.4