diff options
author | Petr Machata <pmachata@redhat.com> | 2011-07-09 11:03:26 +0200 |
---|---|---|
committer | Petr Machata <pmachata@redhat.com> | 2011-10-06 14:17:57 +0200 |
commit | f2d2ba5ce96587f4cc0975441a5da4c6e672e8fa (patch) | |
tree | f96367c7c2553f443edadda3a0bcc3ef51ad6b34 /sysdeps/linux-gnu/x86_64/trace.c | |
parent | 602330f458e8049ec07685c4e02f0368821a2d2c (diff) | |
download | ltrace-f2d2ba5ce96587f4cc0975441a5da4c6e672e8fa.tar.gz |
Fixes for process exit before doing checks for syscalls etc.
Diffstat (limited to 'sysdeps/linux-gnu/x86_64/trace.c')
-rw-r--r-- | sysdeps/linux-gnu/x86_64/trace.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sysdeps/linux-gnu/x86_64/trace.c b/sysdeps/linux-gnu/x86_64/trace.c index e8581af..d0299d9 100644 --- a/sysdeps/linux-gnu/x86_64/trace.c +++ b/sysdeps/linux-gnu/x86_64/trace.c @@ -8,6 +8,7 @@ #include <sys/reg.h> #include <string.h> #include <assert.h> +#include <errno.h> #include "common.h" #include "ptrace.h" @@ -44,8 +45,11 @@ int syscall_p(Process *proc, int status, int *sysnum) { if (WIFSTOPPED(status) && WSTOPSIG(status) == (SIGTRAP | proc->tracesysgood)) { - *sysnum = ptrace(PTRACE_PEEKUSER, proc->pid, 8 * ORIG_RAX, 0); + long int ret = ptrace(PTRACE_PEEKUSER, proc->pid, 8 * ORIG_RAX, 0); + if (ret == -1 && errno) + return -1; + *sysnum = ret; if (proc->callstack_depth > 0 && proc->callstack[proc->callstack_depth - 1].is_syscall && proc->callstack[proc->callstack_depth - 1].c_un.syscall == *sysnum) { |