summaryrefslogtreecommitdiff
path: root/libkmod
diff options
context:
space:
mode:
authorW. Trevor King <wking@tremily.us>2012-10-19 00:50:21 -0400
committerLucas De Marchi <lucas.demarchi@intel.com>2014-03-25 00:34:15 -0300
commite0ff45a04886e12540d2dd00e226c3e17587b6b9 (patch)
tree4460a88f6d2a3b3f97d1b3d3a56feff4688b35dc /libkmod
parent0dd3047efbef69d898ee6c3e11cd0a637def73c3 (diff)
downloadkmod-e0ff45a04886e12540d2dd00e226c3e17587b6b9.tar.gz
kmod-e0ff45a04886e12540d2dd00e226c3e17587b6b9.tar.bz2
kmod-e0ff45a04886e12540d2dd00e226c3e17587b6b9.zip
python: Use Cython's libc.errno for EEXIST.
Diffstat (limited to 'libkmod')
-rw-r--r--libkmod/python/kmod/_libkmod_h.pxd4
-rw-r--r--libkmod/python/kmod/module.pyx4
2 files changed, 3 insertions, 5 deletions
diff --git a/libkmod/python/kmod/_libkmod_h.pxd b/libkmod/python/kmod/_libkmod_h.pxd
index ef948dd..0153ac0 100644
--- a/libkmod/python/kmod/_libkmod_h.pxd
+++ b/libkmod/python/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/libkmod/python/kmod/module.pyx b/libkmod/python/kmod/module.pyx
index 379a75d..7c84eb8 100644
--- a/libkmod/python/kmod/module.pyx
+++ b/libkmod/python/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')