From f3e9e61d7846149daaa8088f1963f6ee5eca1625 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Mon, 30 Nov 2015 15:30:05 +0000 Subject: [PATCH] x86_64: change getregs_old to forward ptrace return code * linux/x86_64/getregs_old.c (getregs_old): Change to return ptrace return code. * syscall.c (get_regs) [ARCH_REGS_FOR_GETREGSET && X86_64]: Use getregs_old return code. --- linux/x86_64/getregs_old.c | 9 +++++---- syscall.c | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/linux/x86_64/getregs_old.c b/linux/x86_64/getregs_old.c index 6911eeea..0ad340fc 100644 --- a/linux/x86_64/getregs_old.c +++ b/linux/x86_64/getregs_old.c @@ -2,13 +2,13 @@ * PTRACE_GETREGSET was added to the kernel in v2.6.25, * a PTRACE_GETREGS based fallback is provided for old kernels. */ -static void +static int getregs_old(pid_t pid) { /* Use old method, with unreliable heuristical detection of 32-bitness. */ - get_regs_error = ptrace(PTRACE_GETREGS, pid, NULL, &x86_64_regs); - if (get_regs_error) - return; + long r = ptrace(PTRACE_GETREGS, pid, NULL, &x86_64_regs); + if (r) + return r; if (x86_64_regs.cs == 0x23) { x86_io.iov_len = sizeof(i386_regs); @@ -36,4 +36,5 @@ getregs_old(pid_t pid) } else { x86_io.iov_len = sizeof(x86_64_regs); } + return 0; } diff --git a/syscall.c b/syscall.c index 99bc731f..a6981d2a 100644 --- a/syscall.c +++ b/syscall.c @@ -1260,7 +1260,7 @@ get_regs(pid_t pid) return; getregset_support = -1; } - getregs_old(pid); + get_regs_error = getregs_old(pid); # else /* !X86_64 */ /* Assume that PTRACE_GETREGSET works. */ get_regs_error = get_regset(pid); -- 2.50.1