Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/checkpoint-restore/criu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Vagin <avagin@openvz.org>2015-09-01 10:47:30 +0300
committerPavel Emelyanov <xemul@parallels.com>2015-09-01 12:26:03 +0300
commit83f79c7e8ccd4e8735c39d0d010fca7d02814001 (patch)
treeae8b1d48ebb3145ddec7c8131877ea382ce1bb2e
parent35ec944304c0b3ac6f7449b252314622041f8ea4 (diff)
ptrace: print error code for PTRACE_DETACH
*** CID 139494: Error handling issues (CHECKED_RETURN) Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
-rw-r--r--ptrace.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/ptrace.c b/ptrace.c
index ff319dbeb..324b52419 100644
--- a/ptrace.c
+++ b/ptrace.c
@@ -39,7 +39,12 @@ int unseize_task(pid_t pid, int orig_st, int st)
} else
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)
@@ -79,7 +84,8 @@ int seize_catch_task(pid_t pid)
ret = ptrace(PTRACE_INTERRUPT, pid, NULL, NULL);
if (ret < 0) {
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;
@@ -227,7 +233,8 @@ try_again:
err_stop:
kill(pid, SIGSTOP);
err:
- ptrace(PTRACE_DETACH, pid, NULL, NULL);
+ if (ptrace(PTRACE_DETACH, pid, NULL, NULL))
+ pr_perror("Unable to detach from %d", pid);
return -1;
}