[1/3] x86/ptrace: describe failures from errno

Submitted by Dmitry Safonov on July 6, 2016, 1:48 p.m.

Details

Message ID 20160706134820.15384-2-dsafonov@virtuozzo.com
State Superseded
Commit acb83b3172cca8c4bc8391dc24f28023e0aefd1d
Headers show

Commit Message

Dmitry Safonov July 6, 2016, 1:48 p.m.
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@virtuozzo.com>
---
 criu/arch/x86/crtools.c | 5 +++++
 1 file changed, 5 insertions(+)

Patch hide | download patch | download mbox

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;