[CRIU] [PATCH 1/3] x86/ptrace: describe failures from errno
Dmitry Safonov
dsafonov at virtuozzo.com
Wed Jul 6 06:48:17 PDT 2016
ptrace_get_regs correctly returns error code in case of failure,
but for debugging reasons let's add error printing in case of
PTRACE_GETREGSET failed right after the call to ptrace().
Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
criu/arch/x86/crtools.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/criu/arch/x86/crtools.c b/criu/arch/x86/crtools.c
index d7a6d105cdf5..97dda697c203 100644
--- a/criu/arch/x86/crtools.c
+++ b/criu/arch/x86/crtools.c
@@ -346,6 +346,11 @@ int ptrace_get_regs(pid_t pid, user_regs_struct_t *regs)
iov.iov_len = sizeof(user_regs_struct64);
ret = ptrace(PTRACE_GETREGSET, pid, NT_PRSTATUS, &iov);
+ if (ret == -1) {
+ pr_perror("PTRACE_GETREGSET failed");
+ return -1;
+ }
+
if (iov.iov_len == sizeof(regs->native)) {
regs->__is_native = NATIVE_MAGIC;
return ret;
--
2.9.0
More information about the CRIU
mailing list