From: Michal Sojka Date: Tue, 12 Sep 2017 11:12:46 +0000 (+0200) Subject: utrace: Report ptrace errors X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fprocd.git;a=commitdiff_plain;h=32534f7058d23dcab44408506848cec199e57fbb utrace: Report ptrace errors --- diff --git a/trace/trace.c b/trace/trace.c index 5189cfb..7fe5599 100644 --- a/trace/trace.c +++ b/trace/trace.c @@ -25,6 +25,7 @@ #include #include #include +#include #ifndef PTRACE_EVENT_STOP /* PTRACE_EVENT_STOP is defined in linux/ptrace.h, but this header @@ -360,8 +361,10 @@ int main(int argc, char **argv, char **envp) ptrace_restart = PTRACE_CONT; break; } - ptrace(PTRACE_SEIZE, child, 0, ptrace_options); - ptrace(ptrace_restart, child, 0, SIGCONT); + if (ptrace(PTRACE_SEIZE, child, 0, ptrace_options) == -1) + err(1, "PTRACE_SEIZE"); + if (ptrace(ptrace_restart, child, 0, SIGCONT) == -1) + err(1, "ptrace restart"); uloop_init(); tracer.proc.pid = child;