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-02-24 21:44:23 +0300
committerPavel Emelyanov <xemul@parallels.com>2015-02-24 21:44:23 +0300
commitd12317ded397fe6ac3650cbbce853d870bb23078 (patch)
treefa84f89c353cf88f46ecf9df02282727a8a66f1f
parent99801e72f0c04247548ffce4d53c70bf4e5085d0 (diff)
ptrace: call wait only if PTRACE_SEIZE was successful
and print errno for the wait syscall in an error case Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
-rw-r--r--ptrace.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/ptrace.c b/ptrace.c
index 70290eb8a..be6b67b2d 100644
--- a/ptrace.c
+++ b/ptrace.c
@@ -50,7 +50,7 @@ int seize_task(pid_t pid, pid_t ppid)
{
siginfo_t si;
int status;
- int ret, ret2, ptrace_errno;
+ int ret, ret2, ptrace_errno, wait_errno = 0;
struct proc_status_creds cr;
ret = ptrace(PTRACE_SEIZE, pid, NULL, 0);
@@ -81,7 +81,10 @@ int seize_task(pid_t pid, pid_t ppid)
*/
try_again:
- ret = wait4(pid, &status, __WALL, NULL);
+ if (!ret) {
+ ret = wait4(pid, &status, __WALL, NULL);
+ wait_errno = errno;
+ }
ret2 = parse_pid_status(pid, &cr);
if (ret2)
@@ -97,8 +100,8 @@ try_again:
if (pid == getpid())
pr_err("The criu itself is within dumped tree.\n");
else
- pr_err("Unseizable non-zombie %d found, state %c, err %d/%d\n",
- pid, cr.state, ret, ptrace_errno);
+ pr_err("Unseizable non-zombie %d found, state %c, err %d/%d/%d\n",
+ pid, cr.state, ret, ptrace_errno, wait_errno);
return -1;
}
@@ -135,6 +138,7 @@ try_again:
goto err;
}
+ ret = 0;
goto try_again;
}