From: W. Trevor King Date: Fri, 19 Oct 2012 04:50:21 +0000 (-0400) Subject: Use Cython's libc.errno for EEXIST. X-Git-Tag: v0.9~1^2~4 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=bf057941fe4bf9957b1f64dcebeff8a0930e9e9c;p=python-kmod.git Use Cython's libc.errno for EEXIST. Signed-off-by: W. Trevor King --- diff --git a/kmod/_libkmod_h.pxd b/kmod/_libkmod_h.pxd index ef948dd..0153ac0 100644 --- a/kmod/_libkmod_h.pxd +++ b/kmod/_libkmod_h.pxd @@ -18,10 +18,6 @@ cdef extern from *: ctypedef void* const_void_ptr 'const void *' -cdef extern from 'errno.h': - enum: EEXIST - - cdef extern from 'stdbool.h': ctypedef struct bool: pass diff --git a/kmod/module.pyx b/kmod/module.pyx index 379a75d..7c84eb8 100644 --- a/kmod/module.pyx +++ b/kmod/module.pyx @@ -9,6 +9,8 @@ # along with this program; if not, write to the Free Software Foundation, # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +cimport libc.errno as _errno + cimport _libkmod_h from error import KmodError as _KmodError cimport list as _list @@ -103,7 +105,7 @@ cdef class Module (object): # TODO: convert callbacks and data from Python object to C types err = _libkmod_h.kmod_module_probe_insert_module( self.module, flags, opt, install, d, print_action) - if err == -_libkmod_h.EEXIST: + if err == -_errno.EEXIST: raise _KmodError('Module already loaded') elif err < 0: raise _KmodError('Could not load module')