From 7e8eb76e9d372e7908c98ed74104ccf1409a01a9 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Thu, 19 Jan 2012 19:21:16 +0400 Subject: [PATCH] ptrace: Print proper errors when seize failed I'd appreciate if we get rid of these misleading macros at all eventually... Signed-off-by: Pavel Emelyanov Signed-off-by: Cyrill Gorcunov --- ptrace.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/ptrace.c b/ptrace.c index e02547cd0..b106ec203 100644 --- a/ptrace.c +++ b/ptrace.c @@ -36,9 +36,18 @@ int seize_task(pid_t pid) int status; int ret = 0; - jerr_rc(ptrace(PTRACE_SEIZE, pid, NULL, - (void *)(unsigned long)PTRACE_SEIZE_DEVEL), ret, err); - jerr_rc(ptrace(PTRACE_INTERRUPT, pid, NULL, NULL), ret, err); + ret = ptrace(PTRACE_SEIZE, pid, NULL, + (void *)(unsigned long)PTRACE_SEIZE_DEVEL); + if (ret < 0) { + pr_perror("Can't seize task\n"); + goto err; + } + + ret = ptrace(PTRACE_INTERRUPT, pid, NULL, NULL); + if (ret < 0) { + pr_perror("Can't interrupt task\n"); + goto err; + } ret = -10; if (wait4(pid, &status, __WALL, NULL) != pid)