Commit 83f79c7e authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

ptrace: print error code for PTRACE_DETACH

*** CID 139494:  Error handling issues  (CHECKED_RETURN)
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 35ec9443
...@@ -39,7 +39,12 @@ int unseize_task(pid_t pid, int orig_st, int st) ...@@ -39,7 +39,12 @@ int unseize_task(pid_t pid, int orig_st, int st)
} else } else
pr_err("Unknown final state %d\n", st); pr_err("Unknown final state %d\n", st);
return ptrace(PTRACE_DETACH, pid, NULL, NULL); if (ptrace(PTRACE_DETACH, pid, NULL, NULL)) {
pr_perror("Unable to detach from %d", pid);
return -1;
}
return 0;
} }
int suspend_seccomp(pid_t pid) int suspend_seccomp(pid_t pid)
...@@ -79,7 +84,8 @@ int seize_catch_task(pid_t pid) ...@@ -79,7 +84,8 @@ int seize_catch_task(pid_t pid)
ret = ptrace(PTRACE_INTERRUPT, pid, NULL, NULL); ret = ptrace(PTRACE_INTERRUPT, pid, NULL, NULL);
if (ret < 0) { if (ret < 0) {
pr_warn("SEIZE %d: can't interrupt task: %s", pid, strerror(errno)); pr_warn("SEIZE %d: can't interrupt task: %s", pid, strerror(errno));
ptrace(PTRACE_DETACH, pid, NULL, NULL); if (ptrace(PTRACE_DETACH, pid, NULL, NULL))
pr_perror("Unable to detach from %d", pid);
} }
return ret; return ret;
...@@ -227,7 +233,8 @@ try_again: ...@@ -227,7 +233,8 @@ try_again:
err_stop: err_stop:
kill(pid, SIGSTOP); kill(pid, SIGSTOP);
err: err:
ptrace(PTRACE_DETACH, pid, NULL, NULL); if (ptrace(PTRACE_DETACH, pid, NULL, NULL))
pr_perror("Unable to detach from %d", pid);
return -1; return -1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment