From d431d4546e5f028646592533d2fa2a53284bc2e4 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Fri, 16 Sep 2011 10:13:00 -0400 Subject: [PATCH] fix ptrace (maybe) --- src/misc/ptrace.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/misc/ptrace.c b/src/misc/ptrace.c index 1cc00167..f8540698 100644 --- a/src/misc/ptrace.c +++ b/src/misc/ptrace.c @@ -8,11 +8,18 @@ long ptrace(int req, ...) va_list ap; pid_t pid; void *addr, *data, *addr2; + long ret, result; + va_start(ap, req); pid = va_arg(ap, pid_t); addr = va_arg(ap, void *); data = va_arg(ap, void *); addr2 = va_arg(ap, void *); va_end(ap); - return syscall(SYS_ptrace, req, pid, addr, data, addr2); + + if (req<4U) data = &result; + ret = syscall(SYS_ptrace, req, pid, addr, data, addr2); + + if (ret<0 || req>=4U) return ret; + return result; } -- 2.25.1