diff --git a/ptrace/binding/func.py b/ptrace/binding/func.py index ca70659..16a9fae 100644 --- a/ptrace/binding/func.py +++ b/ptrace/binding/func.py @@ -135,7 +135,7 @@ HAS_CPTRACE = True except ImportError: HAS_CPTRACE = False - from ctypes import c_long, c_ulong + from ctypes import c_ulong from ptrace.ctypes_libc import libc # Load ptrace() function from the system C library @@ -155,8 +155,8 @@ def ptrace(command, pid=0, arg1=0, arg2=0, check_errno=False): raise PtraceError(message, errno=errno, pid=pid) else: result = _ptrace(command, pid, arg1, arg2) - result_signed = c_long(result).value - if result_signed == -1: + result_unsigned = c_ulong(result).value + if result_unsigned == c_ulong(-1).value: errno = get_errno() # peek operations may returns -1 with errno=0: # it's not an error. For other operations, -1