diff options
author | Rich Felker <dalias@aerifal.cx> | 2011-09-16 10:13:00 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011-09-16 10:13:00 -0400 |
commit | d431d4546e5f028646592533d2fa2a53284bc2e4 (patch) | |
tree | 3e3bfb6e64f3f1f13ba1f9d1ab2cf8cb23705e63 | |
parent | 71f7a3c2ce7377a6c77f46524002505b9454861b (diff) | |
download | musl-d431d4546e5f028646592533d2fa2a53284bc2e4.tar.gz musl-d431d4546e5f028646592533d2fa2a53284bc2e4.tar.bz2 musl-d431d4546e5f028646592533d2fa2a53284bc2e4.tar.xz musl-d431d4546e5f028646592533d2fa2a53284bc2e4.zip |
fix ptrace (maybe)
-rw-r--r-- | src/misc/ptrace.c | 9 |
1 files changed, 8 insertions, 1 deletions
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; } |