[libsemanage/f15/master] Add exception throwing to semanage python library on failures

Daniel J Walsh dwalsh at fedoraproject.org
Fri Mar 11 17:22:15 UTC 2011


commit d7f774425c1ddb0f09688dfb97ccdba03668ba43
Author: Dan Walsh <dwalsh at redhat.com>
Date:   Fri Mar 11 12:22:11 2011 -0500

    Add exception throwing to semanage python library on failures

 libsemanage-rhat.patch | 3279 ++++++++++++++++++++++++++++++++++++++++++++++++
 libsemanage.spec       |   10 +-
 2 files changed, 3283 insertions(+), 6 deletions(-)
---
diff --git a/libsemanage-rhat.patch b/libsemanage-rhat.patch
index bc31a6e..8c71b2b 100644
--- a/libsemanage-rhat.patch
+++ b/libsemanage-rhat.patch
@@ -1,3 +1,127 @@
+diff --git a/libsemanage/src/Makefile b/libsemanage/src/Makefile
+index 7acf63d..a18f84e 100644
+--- a/libsemanage/src/Makefile
++++ b/libsemanage/src/Makefile
+@@ -1,11 +1,39 @@
++# Support building the Python bindings multiple times, against various Python
++# runtimes (e.g. Python 2 vs Python 3) by optionally prefixing the build
++# targets with "PYPREFIX":
++PYTHON ?= python
++PYPREFIX ?= 
++
++# PEP 3149 (in Python 3.2) complicates this by changing the extension for
++# Python modules and the path for Python headers; it now must be queried from
++# the python version in question (e.g. via "python3-config --extension-suffix")
++# Unfortunately, earlier versions of python don't support the
++# "--extension-suffix" option to their -config tools
++PY_DSO_SUFFIX ?= .so
++
+ # Installation directories.
+ PREFIX ?= $(DESTDIR)/usr
+ LIBDIR ?= $(PREFIX)/lib
+ SHLIBDIR ?= $(PREFIX)/lib
+ INCLUDEDIR ?= $(PREFIX)/include
+-PYLIBVER ?= $(shell python -c 'import sys;print "python%d.%d" % sys.version_info[0:2]')
++
++PYLIBVER ?= $(shell $(PYTHON) -c 'import sys;print("python%d.%d" % sys.version_info[0:2])')
+ PYINC ?= /usr/include/${PYLIBVER}
++
++# PEP 3149 means that the path for Python headers might be something like:
++#   /usr/include/python3.2mu
++# and the libraries might be named:
++#   libpython3.2mu.so.1.0
++# Support invoking the Makefile in this way:
++#    make \
++#       PY_INCLUDE_FLAGS="$(python-config --includes)" \
++#       PY_LD_FLAGS="$(python-config --libs)" \
++#      pywrap
++#
++PY_INCLUDE_FLAGS ?= -I ${PYINC}
+ PYLIBDIR ?= $(LIBDIR)/${PYLIBVER}
++PY_LD_FLAGS ?= -l$(PYLIBVER)
++
+ RUBYLIBVER ?= $(shell ruby -e 'print RUBY_VERSION.split(".")[0..1].join(".")')
+ RUBYPLATFORM ?= $(shell ruby -e 'print RUBY_PLATFORM')
+ RUBYINC ?= $(LIBDIR)/ruby/$(RUBYLIBVER)/$(RUBYPLATFORM)
+@@ -30,14 +58,14 @@ LIBVERSION = 1
+ LIBA=libsemanage.a
+ TARGET=libsemanage.so
+ LIBPC=libsemanage.pc
+-SWIGIF= semanageswig_python.i
++SWIGIF= semanageswig_python.i semanageswig_python_exception.i
+ SWIGRUBYIF= semanageswig_ruby.i
+ SWIGCOUT= semanageswig_wrap.c
+ SWIGRUBYCOUT= semanageswig_ruby_wrap.c
+-SWIGLOBJ:= $(patsubst %.c,%.lo,$(SWIGCOUT)) 
++SWIGLOBJ:= $(patsubst %.c,$(PYPREFIX)%.lo,$(SWIGCOUT)) 
+ SWIGRUBYLOBJ:= $(patsubst %.c,%.lo,$(SWIGRUBYCOUT)) 
+-SWIGSO=_semanage.so
+-SWIGFILES=$(SWIGSO) semanage.py 
++SWIGSO=$(PYPREFIX)_semanage$(PY_DSO_SUFFIX)
++SWIGFILES=$(SWIGSO) semanage.py semanageswig_python_exception.i 
+ SWIGRUBYSO=_rubysemanage.so
+ LIBSO=$(TARGET).$(LIBVERSION)
+ 
+@@ -62,14 +90,17 @@ pywrap: all $(SWIGLOBJ) $(SWIGSO)
+ 
+ rubywrap: all $(SWIGRUBYSO)
+ 
++semanageswig_python_exception.i: ../include/semanage/semanage.h
++	bash exception.sh > $@ 
++
+ $(SWIGLOBJ): $(SWIGCOUT)
+-	$(CC) $(filter-out -Werror, $(CFLAGS)) -I$(PYINC) -fPIC -DSHARED -c -o $@ $<
++	$(CC) $(filter-out -Werror, $(CFLAGS)) $(PY_INCLUDE_FLAGS) -fPIC -DSHARED -c -o $@ $<
+ 
+ $(SWIGRUBYLOBJ): $(SWIGRUBYCOUT)
+ 	$(CC) $(filter-out -Werror,$(CFLAGS)) -I$(RUBYINC) -fPIC -DSHARED -c -o $@ $<
+ 
+ $(SWIGSO): $(SWIGLOBJ)
+-	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $< -L. -lsemanage -l$(PYLIBVER) -L$(LIBDIR) -Wl,-soname,$@,-z,defs
++	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $< -L. -lsemanage $(PY_LD_FLAGS) -L$(LIBDIR) -Wl,-soname,$@,-z,defs
+ 
+ $(SWIGRUBYSO): $(SWIGRUBYLOBJ)
+ 	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -L. -lsemanage -L$(LIBDIR) -Wl,-soname,$@
+@@ -118,7 +149,7 @@ $(SWIGRUBYCOUT): $(SWIGRUBYIF)
+ 	$(SWIGRUBY) $^
+ 
+ swigify: $(SWIGIF)
+-	$(SWIG) $^
++	$(SWIG) $<
+ 
+ install: all 
+ 	test -d $(LIBDIR) || install -m 755 -d $(LIBDIR)
+@@ -132,7 +163,9 @@ install: all
+ 
+ install-pywrap: pywrap 
+ 	test -d $(PYLIBDIR)/site-packages || install -m 755 -d $(PYLIBDIR)/site-packages
+-	install -m 755 $(SWIGFILES) $(PYLIBDIR)/site-packages
++	install -m 755 $(SWIGSO) $(PYLIBDIR)/site-packages/_semanage$(PY_DSO_SUFFIX)
++	install -m 755 semanage.py $(PYLIBDIR)/site-packages
++
+ 
+ install-rubywrap: rubywrap
+ 	test -d $(RUBYINSTALL) || install -m 755 -d $(RUBYINSTALL) 
+diff --git a/libsemanage/src/exception.sh b/libsemanage/src/exception.sh
+new file mode 100755
+index 0000000..90acfff
+--- /dev/null
++++ b/libsemanage/src/exception.sh
+@@ -0,0 +1,14 @@
++function except() {
++echo "
++%exception $1 {
++  \$action 
++  if (result < 0) {
++     PyErr_SetFromErrno(PyExc_OSError);
++     return NULL;
++  }
++}
++"
++}
++gcc -x c -c - -aux-info temp.aux < ../include/semanage/semanage.h
++for i in `awk '/extern int/ { print $6 }' temp.aux`; do except $i ; done 
++rm -f -- temp.aux -.o
 diff --git a/libsemanage/src/genhomedircon.c b/libsemanage/src/genhomedircon.c
 index 8a7d5e2..0c5c695 100644
 --- a/libsemanage/src/genhomedircon.c
@@ -23,3 +147,3158 @@ index 8a7d5e2..0c5c695 100644
  		if (push_user_entry(&head, name, seuname,
  				    prefix, pwent->pw_dir) != STATUS_SUCCESS) {
  			*errors = STATUS_ERR;
+diff --git a/libsemanage/src/semanage.py b/libsemanage/src/semanage.py
+index 3cffef7..f978f47 100644
+--- a/libsemanage/src/semanage.py
++++ b/libsemanage/src/semanage.py
+@@ -1,5 +1,5 @@
+ # This file was automatically generated by SWIG (http://www.swig.org).
+-# Version 1.3.40
++# Version 2.0.2
+ #
+ # Do not make changes to this file unless you know what you are doing--modify
+ # the SWIG interface file instead.
+diff --git a/libsemanage/src/semanageswig_python.i b/libsemanage/src/semanageswig_python.i
+index 96c670c..c074f5f 100644
+--- a/libsemanage/src/semanageswig_python.i
++++ b/libsemanage/src/semanageswig_python.i
+@@ -460,4 +460,5 @@
+ 	$1 = &temp;
+ }
+ 
++%include "semanageswig_python_exception.i"
+ %include "semanageswig.i"
+diff --git a/libsemanage/src/semanageswig_wrap.c b/libsemanage/src/semanageswig_wrap.c
+index cffce3a..2bcf4fa 100644
+--- a/libsemanage/src/semanageswig_wrap.c
++++ b/libsemanage/src/semanageswig_wrap.c
+@@ -1,6 +1,6 @@
+ /* ----------------------------------------------------------------------------
+  * This file was automatically generated by SWIG (http://www.swig.org).
+- * Version 1.3.40
++ * Version 2.0.2
+  * 
+  * This file is not intended to be easily readable and contains a number of 
+  * coding conventions designed to improve portability and efficiency. Do not make
+@@ -177,7 +177,7 @@
+ /* 
+    Flags/methods for returning states.
+    
+-   The SWIG conversion methods, as ConvertPtr, return and integer 
++   The SWIG conversion methods, as ConvertPtr, return an integer 
+    that tells if the conversion was successful or not. And if not,
+    an error code can be returned (see swigerrors.swg for the codes).
+    
+@@ -1064,9 +1064,6 @@ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *self, PyObject *func)
+ 
+ 
+ /* -----------------------------------------------------------------------------
+- * See the LICENSE file for information on copyright, usage and redistribution
+- * of SWIG, and the README file for authors - http://www.swig.org/release.html.
+- *
+  * pyrun.swg
+  *
+  * This file contains the runtime support for Python modules
+@@ -1113,8 +1110,18 @@ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *self, PyObject *func)
+ #define SWIG_SetErrorMsg                        	SWIG_Python_SetErrorMsg				   
+ #define SWIG_ErrorType(code)                    	SWIG_Python_ErrorType(code)                        
+ #define SWIG_Error(code, msg)            		SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) 
+-#define SWIG_fail                        		goto fail					   
++#define SWIG_fail                        		goto fail				
+ 
++/*
++ * Python 2.7 and newer and Python 3.1 and newer should use Capsules API instead of
++ * CObjects API.
++ */
++#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \
++     (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0))
++#define USE_CAPSULES
++#define TYPE_POINTER_NAME \
++    ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME)
++#endif
+ 
+ /* Runtime API implementation */
+ 
+@@ -2047,10 +2054,13 @@ _SWIG_This(void)
+     return SWIG_Python_str_FromChar("this");
+ }
+ 
++static PyObject *swig_this = NULL;
++
+ SWIGRUNTIME PyObject *
+ SWIG_This(void)
+ {
+-  static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This();
++  if (swig_this == NULL)
++    swig_this = _SWIG_This();
+   return swig_this;
+ }
+ 
+@@ -2154,7 +2164,7 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
+               int newmemory = 0;
+               *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
+               if (newmemory == SWIG_CAST_NEW_MEMORY) {
+-                assert(own);
++                assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
+                 if (own)
+                   *own = *own | SWIG_CAST_NEW_MEMORY;
+               }
+@@ -2424,8 +2434,12 @@ SWIG_Python_GetModule(void) {
+ #ifdef SWIG_LINK_RUNTIME
+     type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
+ #else
++#ifdef USE_CAPSULES
++    type_pointer = PyCapsule_Import(TYPE_POINTER_NAME, 0);
++#else
+     type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
+ 				    (char*)"type_pointer" SWIG_TYPE_TABLE_NAME);
++#endif
+     if (PyErr_Occurred()) {
+       PyErr_Clear();
+       type_pointer = (void *)0;
+@@ -2470,9 +2484,14 @@ PyModule_AddObject(PyObject *m, char *name, PyObject *o)
+ SWIGRUNTIME void
+ SWIG_Python_DestroyModule(void *vptr)
+ {
++  size_t i;
++#ifdef USE_CAPSULES
++  swig_module_info *swig_module =
++    (swig_module_info *) PyCapsule_GetPointer((PyObject *)vptr, TYPE_POINTER_NAME);
++#else
+   swig_module_info *swig_module = (swig_module_info *) vptr;
++#endif
+   swig_type_info **types = swig_module->types;
+-  size_t i;
+   for (i =0; i < swig_module->size; ++i) {
+     swig_type_info *ty = types[i];
+     if (ty->owndata) {
+@@ -2481,6 +2500,7 @@ SWIG_Python_DestroyModule(void *vptr)
+     }
+   }
+   Py_DECREF(SWIG_This());
++  swig_this = NULL;
+ }
+ 
+ SWIGRUNTIME void
+@@ -2494,9 +2514,18 @@ SWIG_Python_SetModule(swig_module_info *swig_module) {
+   PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
+ 				   swig_empty_runtime_method_table);
+ #endif
++#ifdef USE_CAPSULES
++  PyObject *pointer = PyCapsule_New((void *)swig_module, TYPE_POINTER_NAME,
++				    (PyCapsule_Destructor)SWIG_Python_DestroyModule);
++#else
+   PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
++#endif
+   if (pointer && module) {
++#ifdef USE_CAPSULES
++    PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer);
++#else
+     PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
++#endif
+   } else {
+     Py_XDECREF(pointer);
+   }
+@@ -2517,12 +2546,20 @@ SWIG_Python_TypeQuery(const char *type)
+   PyObject *obj = PyDict_GetItem(cache, key);
+   swig_type_info *descriptor;
+   if (obj) {
++#ifdef USE_CAPSULES
++    descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, type);
++#else
+     descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
++#endif
+   } else {
+     swig_module_info *swig_module = SWIG_Python_GetModule();
+     descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
+     if (descriptor) {
++#ifdef USE_CAPSULES
++      obj = PyCapsule_New(descriptor, type, NULL);
++#else
+       obj = PyCObject_FromVoidPtr(descriptor, NULL);
++#endif
+       PyDict_SetItem(cache, key, obj);
+       Py_DECREF(obj);
+     }
+@@ -2737,7 +2774,7 @@ static swig_module_info swig_module = {swig_types, 54, 0, 0, 0, 0};
+ #endif
+ #define SWIG_name    "_semanage"
+ 
+-#define SWIGVERSION 0x010340 
++#define SWIGVERSION 0x020002 
+ #define SWIG_VERSION SWIGVERSION
+ 
+ 
+@@ -3175,7 +3212,13 @@ SWIGINTERN PyObject *_wrap_semanage_msg_get_level(PyObject *SWIGUNUSEDPARM(self)
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_msg_get_level" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_msg_get_level(arg1);
++  {
++    result = (int)semanage_msg_get_level(arg1); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -3353,7 +3396,13 @@ SWIGINTERN PyObject *_wrap_semanage_reload_policy(PyObject *SWIGUNUSEDPARM(self)
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_reload_policy" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_reload_policy(arg1);
++  {
++    result = (int)semanage_reload_policy(arg1); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -3465,7 +3514,13 @@ SWIGINTERN PyObject *_wrap_semanage_get_disable_dontaudit(PyObject *SWIGUNUSEDPA
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_get_disable_dontaudit" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_get_disable_dontaudit(arg1);
++  {
++    result = (int)semanage_get_disable_dontaudit(arg1); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -3547,7 +3602,13 @@ SWIGINTERN PyObject *_wrap_semanage_is_managed(PyObject *SWIGUNUSEDPARM(self), P
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_is_managed" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_is_managed(arg1);
++  {
++    result = (int)semanage_is_managed(arg1); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -3569,7 +3630,13 @@ SWIGINTERN PyObject *_wrap_semanage_connect(PyObject *SWIGUNUSEDPARM(self), PyOb
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_connect" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_connect(arg1);
++  {
++    result = (int)semanage_connect(arg1); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -3591,7 +3658,13 @@ SWIGINTERN PyObject *_wrap_semanage_disconnect(PyObject *SWIGUNUSEDPARM(self), P
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_disconnect" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_disconnect(arg1);
++  {
++    result = (int)semanage_disconnect(arg1); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -3613,7 +3686,13 @@ SWIGINTERN PyObject *_wrap_semanage_begin_transaction(PyObject *SWIGUNUSEDPARM(s
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_begin_transaction" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_begin_transaction(arg1);
++  {
++    result = (int)semanage_begin_transaction(arg1); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -3635,7 +3714,13 @@ SWIGINTERN PyObject *_wrap_semanage_commit(PyObject *SWIGUNUSEDPARM(self), PyObj
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_commit" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_commit(arg1);
++  {
++    result = (int)semanage_commit(arg1); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -3657,7 +3742,13 @@ SWIGINTERN PyObject *_wrap_semanage_access_check(PyObject *SWIGUNUSEDPARM(self),
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_access_check" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_access_check(arg1);
++  {
++    result = (int)semanage_access_check(arg1); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -3679,7 +3770,13 @@ SWIGINTERN PyObject *_wrap_semanage_is_connected(PyObject *SWIGUNUSEDPARM(self),
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_is_connected" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_is_connected(arg1);
++  {
++    result = (int)semanage_is_connected(arg1); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -3701,7 +3798,13 @@ SWIGINTERN PyObject *_wrap_semanage_mls_enabled(PyObject *SWIGUNUSEDPARM(self),
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_mls_enabled" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_mls_enabled(arg1);
++  {
++    result = (int)semanage_mls_enabled(arg1); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -3742,7 +3845,13 @@ SWIGINTERN PyObject *_wrap_semanage_module_install(PyObject *SWIGUNUSEDPARM(self
+     SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "semanage_module_install" "', argument " "3"" of type '" "size_t""'");
+   } 
+   arg3 = (size_t)(val3);
+-  result = (int)semanage_module_install(arg1,arg2,arg3);
++  {
++    result = (int)semanage_module_install(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+   return resultobj;
+@@ -3776,7 +3885,13 @@ SWIGINTERN PyObject *_wrap_semanage_module_install_file(PyObject *SWIGUNUSEDPARM
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_module_install_file" "', argument " "2"" of type '" "char const *""'");
+   }
+   arg2 = (char *)(buf2);
+-  result = (int)semanage_module_install_file(arg1,(char const *)arg2);
++  {
++    result = (int)semanage_module_install_file(arg1,(char const *)arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+   return resultobj;
+@@ -3819,7 +3934,13 @@ SWIGINTERN PyObject *_wrap_semanage_module_upgrade(PyObject *SWIGUNUSEDPARM(self
+     SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "semanage_module_upgrade" "', argument " "3"" of type '" "size_t""'");
+   } 
+   arg3 = (size_t)(val3);
+-  result = (int)semanage_module_upgrade(arg1,arg2,arg3);
++  {
++    result = (int)semanage_module_upgrade(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+   return resultobj;
+@@ -3853,7 +3974,13 @@ SWIGINTERN PyObject *_wrap_semanage_module_upgrade_file(PyObject *SWIGUNUSEDPARM
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_module_upgrade_file" "', argument " "2"" of type '" "char const *""'");
+   }
+   arg2 = (char *)(buf2);
+-  result = (int)semanage_module_upgrade_file(arg1,(char const *)arg2);
++  {
++    result = (int)semanage_module_upgrade_file(arg1,(char const *)arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+   return resultobj;
+@@ -3896,7 +4023,13 @@ SWIGINTERN PyObject *_wrap_semanage_module_install_base(PyObject *SWIGUNUSEDPARM
+     SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "semanage_module_install_base" "', argument " "3"" of type '" "size_t""'");
+   } 
+   arg3 = (size_t)(val3);
+-  result = (int)semanage_module_install_base(arg1,arg2,arg3);
++  {
++    result = (int)semanage_module_install_base(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+   return resultobj;
+@@ -3930,7 +4063,13 @@ SWIGINTERN PyObject *_wrap_semanage_module_install_base_file(PyObject *SWIGUNUSE
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_module_install_base_file" "', argument " "2"" of type '" "char const *""'");
+   }
+   arg2 = (char *)(buf2);
+-  result = (int)semanage_module_install_base_file(arg1,(char const *)arg2);
++  {
++    result = (int)semanage_module_install_base_file(arg1,(char const *)arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+   return resultobj;
+@@ -3964,7 +4103,13 @@ SWIGINTERN PyObject *_wrap_semanage_module_enable(PyObject *SWIGUNUSEDPARM(self)
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_module_enable" "', argument " "2"" of type '" "char *""'");
+   }
+   arg2 = (char *)(buf2);
+-  result = (int)semanage_module_enable(arg1,arg2);
++  {
++    result = (int)semanage_module_enable(arg1,arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+   return resultobj;
+@@ -3998,7 +4143,13 @@ SWIGINTERN PyObject *_wrap_semanage_module_disable(PyObject *SWIGUNUSEDPARM(self
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_module_disable" "', argument " "2"" of type '" "char *""'");
+   }
+   arg2 = (char *)(buf2);
+-  result = (int)semanage_module_disable(arg1,arg2);
++  {
++    result = (int)semanage_module_disable(arg1,arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+   return resultobj;
+@@ -4032,7 +4183,13 @@ SWIGINTERN PyObject *_wrap_semanage_module_remove(PyObject *SWIGUNUSEDPARM(self)
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_module_remove" "', argument " "2"" of type '" "char *""'");
+   }
+   arg2 = (char *)(buf2);
+-  result = (int)semanage_module_remove(arg1,arg2);
++  {
++    result = (int)semanage_module_remove(arg1,arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+   return resultobj;
+@@ -4065,7 +4222,13 @@ SWIGINTERN PyObject *_wrap_semanage_module_list(PyObject *SWIGUNUSEDPARM(self),
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_module_list" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_module_list(arg1,arg2,arg3);
++  {
++    result = (int)semanage_module_list(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg2, SWIGTYPE_p_semanage_module_info, 0));
+@@ -4192,7 +4355,13 @@ SWIGINTERN PyObject *_wrap_semanage_module_get_enabled(PyObject *SWIGUNUSEDPARM(
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_module_get_enabled" "', argument " "1"" of type '" "semanage_module_info_t *""'"); 
+   }
+   arg1 = (semanage_module_info_t *)(argp1);
+-  result = (int)semanage_module_get_enabled(arg1);
++  {
++    result = (int)semanage_module_get_enabled(arg1); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -4255,7 +4424,13 @@ SWIGINTERN PyObject *_wrap_semanage_context_set_user(PyObject *SWIGUNUSEDPARM(se
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_context_set_user" "', argument " "3"" of type '" "char const *""'");
+   }
+   arg3 = (char *)(buf3);
+-  result = (int)semanage_context_set_user(arg1,arg2,(char const *)arg3);
++  {
++    result = (int)semanage_context_set_user(arg1,arg2,(char const *)arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
+   return resultobj;
+@@ -4320,7 +4495,13 @@ SWIGINTERN PyObject *_wrap_semanage_context_set_role(PyObject *SWIGUNUSEDPARM(se
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_context_set_role" "', argument " "3"" of type '" "char const *""'");
+   }
+   arg3 = (char *)(buf3);
+-  result = (int)semanage_context_set_role(arg1,arg2,(char const *)arg3);
++  {
++    result = (int)semanage_context_set_role(arg1,arg2,(char const *)arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
+   return resultobj;
+@@ -4385,7 +4566,13 @@ SWIGINTERN PyObject *_wrap_semanage_context_set_type(PyObject *SWIGUNUSEDPARM(se
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_context_set_type" "', argument " "3"" of type '" "char const *""'");
+   }
+   arg3 = (char *)(buf3);
+-  result = (int)semanage_context_set_type(arg1,arg2,(char const *)arg3);
++  {
++    result = (int)semanage_context_set_type(arg1,arg2,(char const *)arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
+   return resultobj;
+@@ -4450,7 +4637,13 @@ SWIGINTERN PyObject *_wrap_semanage_context_set_mls(PyObject *SWIGUNUSEDPARM(sel
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_context_set_mls" "', argument " "3"" of type '" "char const *""'");
+   }
+   arg3 = (char *)(buf3);
+-  result = (int)semanage_context_set_mls(arg1,arg2,(char const *)arg3);
++  {
++    result = (int)semanage_context_set_mls(arg1,arg2,(char const *)arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
+   return resultobj;
+@@ -4479,7 +4672,13 @@ SWIGINTERN PyObject *_wrap_semanage_context_create(PyObject *SWIGUNUSEDPARM(self
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_context_create" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_context_create(arg1,arg2);
++  {
++    result = (int)semanage_context_create(arg1,arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg2, SWIGTYPE_p_semanage_context, 0));
+@@ -4518,7 +4717,13 @@ SWIGINTERN PyObject *_wrap_semanage_context_clone(PyObject *SWIGUNUSEDPARM(self)
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_context_clone" "', argument " "2"" of type '" "semanage_context_t const *""'"); 
+   }
+   arg2 = (semanage_context_t *)(argp2);
+-  result = (int)semanage_context_clone(arg1,(struct semanage_context const *)arg2,arg3);
++  {
++    result = (int)semanage_context_clone(arg1,(struct semanage_context const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_context, 0));
+@@ -4579,7 +4784,13 @@ SWIGINTERN PyObject *_wrap_semanage_context_from_string(PyObject *SWIGUNUSEDPARM
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_context_from_string" "', argument " "2"" of type '" "char const *""'");
+   }
+   arg2 = (char *)(buf2);
+-  result = (int)semanage_context_from_string(arg1,(char const *)arg2,arg3);
++  {
++    result = (int)semanage_context_from_string(arg1,(char const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_context, 0));
+@@ -4620,7 +4831,13 @@ SWIGINTERN PyObject *_wrap_semanage_context_to_string(PyObject *SWIGUNUSEDPARM(s
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_context_to_string" "', argument " "2"" of type '" "semanage_context_t const *""'"); 
+   }
+   arg2 = (semanage_context_t *)(argp2);
+-  result = (int)semanage_context_to_string(arg1,(struct semanage_context const *)arg2,arg3);
++  {
++    result = (int)semanage_context_to_string(arg1,(struct semanage_context const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(*arg3));
+@@ -4661,7 +4878,13 @@ SWIGINTERN PyObject *_wrap_semanage_bool_key_create(PyObject *SWIGUNUSEDPARM(sel
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_bool_key_create" "', argument " "2"" of type '" "char const *""'");
+   }
+   arg2 = (char *)(buf2);
+-  result = (int)semanage_bool_key_create(arg1,(char const *)arg2,arg3);
++  {
++    result = (int)semanage_bool_key_create(arg1,(char const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_bool_key, 0));
+@@ -4702,7 +4925,13 @@ SWIGINTERN PyObject *_wrap_semanage_bool_key_extract(PyObject *SWIGUNUSEDPARM(se
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_bool_key_extract" "', argument " "2"" of type '" "semanage_bool_t const *""'"); 
+   }
+   arg2 = (semanage_bool_t *)(argp2);
+-  result = (int)semanage_bool_key_extract(arg1,(struct semanage_bool const *)arg2,arg3);
++  {
++    result = (int)semanage_bool_key_extract(arg1,(struct semanage_bool const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_bool_key, 0));
+@@ -4757,7 +4986,13 @@ SWIGINTERN PyObject *_wrap_semanage_bool_compare(PyObject *SWIGUNUSEDPARM(self),
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_bool_compare" "', argument " "2"" of type '" "semanage_bool_key_t const *""'"); 
+   }
+   arg2 = (semanage_bool_key_t *)(argp2);
+-  result = (int)semanage_bool_compare((struct semanage_bool const *)arg1,(struct semanage_bool_key const *)arg2);
++  {
++    result = (int)semanage_bool_compare((struct semanage_bool const *)arg1,(struct semanage_bool_key const *)arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -4788,7 +5023,13 @@ SWIGINTERN PyObject *_wrap_semanage_bool_compare2(PyObject *SWIGUNUSEDPARM(self)
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_bool_compare2" "', argument " "2"" of type '" "semanage_bool_t const *""'"); 
+   }
+   arg2 = (semanage_bool_t *)(argp2);
+-  result = (int)semanage_bool_compare2((struct semanage_bool const *)arg1,(struct semanage_bool const *)arg2);
++  {
++    result = (int)semanage_bool_compare2((struct semanage_bool const *)arg1,(struct semanage_bool const *)arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -4851,7 +5092,13 @@ SWIGINTERN PyObject *_wrap_semanage_bool_set_name(PyObject *SWIGUNUSEDPARM(self)
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_bool_set_name" "', argument " "3"" of type '" "char const *""'");
+   }
+   arg3 = (char *)(buf3);
+-  result = (int)semanage_bool_set_name(arg1,arg2,(char const *)arg3);
++  {
++    result = (int)semanage_bool_set_name(arg1,arg2,(char const *)arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
+   return resultobj;
+@@ -4875,7 +5122,13 @@ SWIGINTERN PyObject *_wrap_semanage_bool_get_value(PyObject *SWIGUNUSEDPARM(self
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_bool_get_value" "', argument " "1"" of type '" "semanage_bool_t const *""'"); 
+   }
+   arg1 = (semanage_bool_t *)(argp1);
+-  result = (int)semanage_bool_get_value((struct semanage_bool const *)arg1);
++  {
++    result = (int)semanage_bool_get_value((struct semanage_bool const *)arg1); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -4932,7 +5185,13 @@ SWIGINTERN PyObject *_wrap_semanage_bool_create(PyObject *SWIGUNUSEDPARM(self),
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_bool_create" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_bool_create(arg1,arg2);
++  {
++    result = (int)semanage_bool_create(arg1,arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg2, SWIGTYPE_p_semanage_bool, 0));
+@@ -4971,7 +5230,13 @@ SWIGINTERN PyObject *_wrap_semanage_bool_clone(PyObject *SWIGUNUSEDPARM(self), P
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_bool_clone" "', argument " "2"" of type '" "semanage_bool_t const *""'"); 
+   }
+   arg2 = (semanage_bool_t *)(argp2);
+-  result = (int)semanage_bool_clone(arg1,(struct semanage_bool const *)arg2,arg3);
++  {
++    result = (int)semanage_bool_clone(arg1,(struct semanage_bool const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_bool, 0));
+@@ -5031,7 +5296,13 @@ SWIGINTERN PyObject *_wrap_semanage_bool_query(PyObject *SWIGUNUSEDPARM(self), P
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_bool_query" "', argument " "2"" of type '" "semanage_bool_key_t const *""'"); 
+   }
+   arg2 = (semanage_bool_key_t *)(argp2);
+-  result = (int)semanage_bool_query(arg1,(struct semanage_bool_key const *)arg2,arg3);
++  {
++    result = (int)semanage_bool_query(arg1,(struct semanage_bool_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_bool, 0));
+@@ -5069,7 +5340,13 @@ SWIGINTERN PyObject *_wrap_semanage_bool_exists(PyObject *SWIGUNUSEDPARM(self),
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_bool_exists" "', argument " "2"" of type '" "semanage_bool_key_t const *""'"); 
+   }
+   arg2 = (semanage_bool_key_t *)(argp2);
+-  result = (int)semanage_bool_exists(arg1,(struct semanage_bool_key const *)arg2,arg3);
++  {
++    result = (int)semanage_bool_exists(arg1,(struct semanage_bool_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (SWIG_IsTmpObj(res3)) {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3)));
+@@ -5101,7 +5378,13 @@ SWIGINTERN PyObject *_wrap_semanage_bool_count(PyObject *SWIGUNUSEDPARM(self), P
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_bool_count" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_bool_count(arg1,arg2);
++  {
++    result = (int)semanage_bool_count(arg1,arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (SWIG_IsTmpObj(res2)) {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg2)));
+@@ -5144,7 +5427,13 @@ SWIGINTERN PyObject *_wrap_semanage_bool_iterate(PyObject *SWIGUNUSEDPARM(self),
+   if (!SWIG_IsOK(res3)) {
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_bool_iterate" "', argument " "3"" of type '" "void *""'"); 
+   }
+-  result = (int)semanage_bool_iterate(arg1,arg2,arg3);
++  {
++    result = (int)semanage_bool_iterate(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -5175,7 +5464,13 @@ SWIGINTERN PyObject *_wrap_semanage_bool_list(PyObject *SWIGUNUSEDPARM(self), Py
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_bool_list" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_bool_list(arg1,arg2,arg3);
++  {
++    result = (int)semanage_bool_list(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     if (resultobj) {
+@@ -5229,7 +5524,13 @@ SWIGINTERN PyObject *_wrap_semanage_bool_modify_local(PyObject *SWIGUNUSEDPARM(s
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_bool_modify_local" "', argument " "3"" of type '" "semanage_bool_t const *""'"); 
+   }
+   arg3 = (semanage_bool_t *)(argp3);
+-  result = (int)semanage_bool_modify_local(arg1,(struct semanage_bool_key const *)arg2,(struct semanage_bool const *)arg3);
++  {
++    result = (int)semanage_bool_modify_local(arg1,(struct semanage_bool_key const *)arg2,(struct semanage_bool const *)arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -5260,7 +5561,13 @@ SWIGINTERN PyObject *_wrap_semanage_bool_del_local(PyObject *SWIGUNUSEDPARM(self
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_bool_del_local" "', argument " "2"" of type '" "semanage_bool_key_t const *""'"); 
+   }
+   arg2 = (semanage_bool_key_t *)(argp2);
+-  result = (int)semanage_bool_del_local(arg1,(struct semanage_bool_key const *)arg2);
++  {
++    result = (int)semanage_bool_del_local(arg1,(struct semanage_bool_key const *)arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -5296,7 +5603,13 @@ SWIGINTERN PyObject *_wrap_semanage_bool_query_local(PyObject *SWIGUNUSEDPARM(se
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_bool_query_local" "', argument " "2"" of type '" "semanage_bool_key_t const *""'"); 
+   }
+   arg2 = (semanage_bool_key_t *)(argp2);
+-  result = (int)semanage_bool_query_local(arg1,(struct semanage_bool_key const *)arg2,arg3);
++  {
++    result = (int)semanage_bool_query_local(arg1,(struct semanage_bool_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_bool, 0));
+@@ -5334,7 +5647,13 @@ SWIGINTERN PyObject *_wrap_semanage_bool_exists_local(PyObject *SWIGUNUSEDPARM(s
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_bool_exists_local" "', argument " "2"" of type '" "semanage_bool_key_t const *""'"); 
+   }
+   arg2 = (semanage_bool_key_t *)(argp2);
+-  result = (int)semanage_bool_exists_local(arg1,(struct semanage_bool_key const *)arg2,arg3);
++  {
++    result = (int)semanage_bool_exists_local(arg1,(struct semanage_bool_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (SWIG_IsTmpObj(res3)) {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3)));
+@@ -5366,7 +5685,13 @@ SWIGINTERN PyObject *_wrap_semanage_bool_count_local(PyObject *SWIGUNUSEDPARM(se
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_bool_count_local" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_bool_count_local(arg1,arg2);
++  {
++    result = (int)semanage_bool_count_local(arg1,arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (SWIG_IsTmpObj(res2)) {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg2)));
+@@ -5409,7 +5734,13 @@ SWIGINTERN PyObject *_wrap_semanage_bool_iterate_local(PyObject *SWIGUNUSEDPARM(
+   if (!SWIG_IsOK(res3)) {
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_bool_iterate_local" "', argument " "3"" of type '" "void *""'"); 
+   }
+-  result = (int)semanage_bool_iterate_local(arg1,arg2,arg3);
++  {
++    result = (int)semanage_bool_iterate_local(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -5440,7 +5771,13 @@ SWIGINTERN PyObject *_wrap_semanage_bool_list_local(PyObject *SWIGUNUSEDPARM(sel
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_bool_list_local" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_bool_list_local(arg1,arg2,arg3);
++  {
++    result = (int)semanage_bool_list_local(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     if (resultobj) {
+@@ -5494,7 +5831,13 @@ SWIGINTERN PyObject *_wrap_semanage_bool_set_active(PyObject *SWIGUNUSEDPARM(sel
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_bool_set_active" "', argument " "3"" of type '" "semanage_bool_t const *""'"); 
+   }
+   arg3 = (semanage_bool_t *)(argp3);
+-  result = (int)semanage_bool_set_active(arg1,(struct semanage_bool_key const *)arg2,(struct semanage_bool const *)arg3);
++  {
++    result = (int)semanage_bool_set_active(arg1,(struct semanage_bool_key const *)arg2,(struct semanage_bool const *)arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -5530,7 +5873,13 @@ SWIGINTERN PyObject *_wrap_semanage_bool_query_active(PyObject *SWIGUNUSEDPARM(s
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_bool_query_active" "', argument " "2"" of type '" "semanage_bool_key_t const *""'"); 
+   }
+   arg2 = (semanage_bool_key_t *)(argp2);
+-  result = (int)semanage_bool_query_active(arg1,(struct semanage_bool_key const *)arg2,arg3);
++  {
++    result = (int)semanage_bool_query_active(arg1,(struct semanage_bool_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_bool, 0));
+@@ -5568,7 +5917,13 @@ SWIGINTERN PyObject *_wrap_semanage_bool_exists_active(PyObject *SWIGUNUSEDPARM(
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_bool_exists_active" "', argument " "2"" of type '" "semanage_bool_key_t const *""'"); 
+   }
+   arg2 = (semanage_bool_key_t *)(argp2);
+-  result = (int)semanage_bool_exists_active(arg1,(struct semanage_bool_key const *)arg2,arg3);
++  {
++    result = (int)semanage_bool_exists_active(arg1,(struct semanage_bool_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (SWIG_IsTmpObj(res3)) {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3)));
+@@ -5600,7 +5955,13 @@ SWIGINTERN PyObject *_wrap_semanage_bool_count_active(PyObject *SWIGUNUSEDPARM(s
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_bool_count_active" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_bool_count_active(arg1,arg2);
++  {
++    result = (int)semanage_bool_count_active(arg1,arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (SWIG_IsTmpObj(res2)) {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg2)));
+@@ -5643,7 +6004,13 @@ SWIGINTERN PyObject *_wrap_semanage_bool_iterate_active(PyObject *SWIGUNUSEDPARM
+   if (!SWIG_IsOK(res3)) {
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_bool_iterate_active" "', argument " "3"" of type '" "void *""'"); 
+   }
+-  result = (int)semanage_bool_iterate_active(arg1,arg2,arg3);
++  {
++    result = (int)semanage_bool_iterate_active(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -5674,7 +6041,13 @@ SWIGINTERN PyObject *_wrap_semanage_bool_list_active(PyObject *SWIGUNUSEDPARM(se
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_bool_list_active" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_bool_list_active(arg1,arg2,arg3);
++  {
++    result = (int)semanage_bool_list_active(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     if (resultobj) {
+@@ -5719,7 +6092,13 @@ SWIGINTERN PyObject *_wrap_semanage_iface_compare(PyObject *SWIGUNUSEDPARM(self)
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_iface_compare" "', argument " "2"" of type '" "semanage_iface_key_t const *""'"); 
+   }
+   arg2 = (semanage_iface_key_t *)(argp2);
+-  result = (int)semanage_iface_compare((struct semanage_iface const *)arg1,(struct semanage_iface_key const *)arg2);
++  {
++    result = (int)semanage_iface_compare((struct semanage_iface const *)arg1,(struct semanage_iface_key const *)arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -5750,7 +6129,13 @@ SWIGINTERN PyObject *_wrap_semanage_iface_compare2(PyObject *SWIGUNUSEDPARM(self
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_iface_compare2" "', argument " "2"" of type '" "semanage_iface_t const *""'"); 
+   }
+   arg2 = (semanage_iface_t *)(argp2);
+-  result = (int)semanage_iface_compare2((struct semanage_iface const *)arg1,(struct semanage_iface const *)arg2);
++  {
++    result = (int)semanage_iface_compare2((struct semanage_iface const *)arg1,(struct semanage_iface const *)arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -5787,7 +6172,13 @@ SWIGINTERN PyObject *_wrap_semanage_iface_key_create(PyObject *SWIGUNUSEDPARM(se
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_iface_key_create" "', argument " "2"" of type '" "char const *""'");
+   }
+   arg2 = (char *)(buf2);
+-  result = (int)semanage_iface_key_create(arg1,(char const *)arg2,arg3);
++  {
++    result = (int)semanage_iface_key_create(arg1,(char const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_iface_key, 0));
+@@ -5828,8 +6219,14 @@ SWIGINTERN PyObject *_wrap_semanage_iface_key_extract(PyObject *SWIGUNUSEDPARM(s
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_iface_key_extract" "', argument " "2"" of type '" "semanage_iface_t const *""'"); 
+   }
+   arg2 = (semanage_iface_t *)(argp2);
+-  result = (int)semanage_iface_key_extract(arg1,(struct semanage_iface const *)arg2,arg3);
+-  resultobj = SWIG_From_int((int)(result));
++  {
++    result = (int)semanage_iface_key_extract(arg1,(struct semanage_iface const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
++  resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_iface_key, 0));
+   }
+@@ -5915,7 +6312,13 @@ SWIGINTERN PyObject *_wrap_semanage_iface_set_name(PyObject *SWIGUNUSEDPARM(self
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_iface_set_name" "', argument " "3"" of type '" "char const *""'");
+   }
+   arg3 = (char *)(buf3);
+-  result = (int)semanage_iface_set_name(arg1,arg2,(char const *)arg3);
++  {
++    result = (int)semanage_iface_set_name(arg1,arg2,(char const *)arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
+   return resultobj;
+@@ -5979,7 +6382,13 @@ SWIGINTERN PyObject *_wrap_semanage_iface_set_ifcon(PyObject *SWIGUNUSEDPARM(sel
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_iface_set_ifcon" "', argument " "3"" of type '" "semanage_context_t *""'"); 
+   }
+   arg3 = (semanage_context_t *)(argp3);
+-  result = (int)semanage_iface_set_ifcon(arg1,arg2,arg3);
++  {
++    result = (int)semanage_iface_set_ifcon(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -6041,7 +6450,13 @@ SWIGINTERN PyObject *_wrap_semanage_iface_set_msgcon(PyObject *SWIGUNUSEDPARM(se
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_iface_set_msgcon" "', argument " "3"" of type '" "semanage_context_t *""'"); 
+   }
+   arg3 = (semanage_context_t *)(argp3);
+-  result = (int)semanage_iface_set_msgcon(arg1,arg2,arg3);
++  {
++    result = (int)semanage_iface_set_msgcon(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -6068,7 +6483,13 @@ SWIGINTERN PyObject *_wrap_semanage_iface_create(PyObject *SWIGUNUSEDPARM(self),
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_iface_create" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_iface_create(arg1,arg2);
++  {
++    result = (int)semanage_iface_create(arg1,arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg2, SWIGTYPE_p_semanage_iface, 0));
+@@ -6107,7 +6528,13 @@ SWIGINTERN PyObject *_wrap_semanage_iface_clone(PyObject *SWIGUNUSEDPARM(self),
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_iface_clone" "', argument " "2"" of type '" "semanage_iface_t const *""'"); 
+   }
+   arg2 = (semanage_iface_t *)(argp2);
+-  result = (int)semanage_iface_clone(arg1,(struct semanage_iface const *)arg2,arg3);
++  {
++    result = (int)semanage_iface_clone(arg1,(struct semanage_iface const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_iface, 0));
+@@ -6171,7 +6598,13 @@ SWIGINTERN PyObject *_wrap_semanage_iface_modify_local(PyObject *SWIGUNUSEDPARM(
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_iface_modify_local" "', argument " "3"" of type '" "semanage_iface_t const *""'"); 
+   }
+   arg3 = (semanage_iface_t *)(argp3);
+-  result = (int)semanage_iface_modify_local(arg1,(struct semanage_iface_key const *)arg2,(struct semanage_iface const *)arg3);
++  {
++    result = (int)semanage_iface_modify_local(arg1,(struct semanage_iface_key const *)arg2,(struct semanage_iface const *)arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -6202,7 +6635,13 @@ SWIGINTERN PyObject *_wrap_semanage_iface_del_local(PyObject *SWIGUNUSEDPARM(sel
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_iface_del_local" "', argument " "2"" of type '" "semanage_iface_key_t const *""'"); 
+   }
+   arg2 = (semanage_iface_key_t *)(argp2);
+-  result = (int)semanage_iface_del_local(arg1,(struct semanage_iface_key const *)arg2);
++  {
++    result = (int)semanage_iface_del_local(arg1,(struct semanage_iface_key const *)arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -6238,7 +6677,13 @@ SWIGINTERN PyObject *_wrap_semanage_iface_query_local(PyObject *SWIGUNUSEDPARM(s
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_iface_query_local" "', argument " "2"" of type '" "semanage_iface_key_t const *""'"); 
+   }
+   arg2 = (semanage_iface_key_t *)(argp2);
+-  result = (int)semanage_iface_query_local(arg1,(struct semanage_iface_key const *)arg2,arg3);
++  {
++    result = (int)semanage_iface_query_local(arg1,(struct semanage_iface_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_iface, 0));
+@@ -6276,7 +6721,13 @@ SWIGINTERN PyObject *_wrap_semanage_iface_exists_local(PyObject *SWIGUNUSEDPARM(
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_iface_exists_local" "', argument " "2"" of type '" "semanage_iface_key_t const *""'"); 
+   }
+   arg2 = (semanage_iface_key_t *)(argp2);
+-  result = (int)semanage_iface_exists_local(arg1,(struct semanage_iface_key const *)arg2,arg3);
++  {
++    result = (int)semanage_iface_exists_local(arg1,(struct semanage_iface_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (SWIG_IsTmpObj(res3)) {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3)));
+@@ -6308,7 +6759,13 @@ SWIGINTERN PyObject *_wrap_semanage_iface_count_local(PyObject *SWIGUNUSEDPARM(s
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_iface_count_local" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_iface_count_local(arg1,arg2);
++  {
++    result = (int)semanage_iface_count_local(arg1,arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (SWIG_IsTmpObj(res2)) {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg2)));
+@@ -6351,7 +6808,13 @@ SWIGINTERN PyObject *_wrap_semanage_iface_iterate_local(PyObject *SWIGUNUSEDPARM
+   if (!SWIG_IsOK(res3)) {
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_iface_iterate_local" "', argument " "3"" of type '" "void *""'"); 
+   }
+-  result = (int)semanage_iface_iterate_local(arg1,arg2,arg3);
++  {
++    result = (int)semanage_iface_iterate_local(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -6382,7 +6845,13 @@ SWIGINTERN PyObject *_wrap_semanage_iface_list_local(PyObject *SWIGUNUSEDPARM(se
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_iface_list_local" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_iface_list_local(arg1,arg2,arg3);
++  {
++    result = (int)semanage_iface_list_local(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     if (resultobj) {
+@@ -6432,7 +6901,13 @@ SWIGINTERN PyObject *_wrap_semanage_iface_query(PyObject *SWIGUNUSEDPARM(self),
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_iface_query" "', argument " "2"" of type '" "semanage_iface_key_t const *""'"); 
+   }
+   arg2 = (semanage_iface_key_t *)(argp2);
+-  result = (int)semanage_iface_query(arg1,(struct semanage_iface_key const *)arg2,arg3);
++  {
++    result = (int)semanage_iface_query(arg1,(struct semanage_iface_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_iface, 0));
+@@ -6470,7 +6945,13 @@ SWIGINTERN PyObject *_wrap_semanage_iface_exists(PyObject *SWIGUNUSEDPARM(self),
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_iface_exists" "', argument " "2"" of type '" "semanage_iface_key_t const *""'"); 
+   }
+   arg2 = (semanage_iface_key_t *)(argp2);
+-  result = (int)semanage_iface_exists(arg1,(struct semanage_iface_key const *)arg2,arg3);
++  {
++    result = (int)semanage_iface_exists(arg1,(struct semanage_iface_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (SWIG_IsTmpObj(res3)) {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3)));
+@@ -6502,7 +6983,13 @@ SWIGINTERN PyObject *_wrap_semanage_iface_count(PyObject *SWIGUNUSEDPARM(self),
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_iface_count" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_iface_count(arg1,arg2);
++  {
++    result = (int)semanage_iface_count(arg1,arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (SWIG_IsTmpObj(res2)) {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg2)));
+@@ -6545,7 +7032,13 @@ SWIGINTERN PyObject *_wrap_semanage_iface_iterate(PyObject *SWIGUNUSEDPARM(self)
+   if (!SWIG_IsOK(res3)) {
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_iface_iterate" "', argument " "3"" of type '" "void *""'"); 
+   }
+-  result = (int)semanage_iface_iterate(arg1,arg2,arg3);
++  {
++    result = (int)semanage_iface_iterate(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -6576,7 +7069,13 @@ SWIGINTERN PyObject *_wrap_semanage_iface_list(PyObject *SWIGUNUSEDPARM(self), P
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_iface_list" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_iface_list(arg1,arg2,arg3);
++  {
++    result = (int)semanage_iface_list(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     if (resultobj) {
+@@ -6627,7 +7126,13 @@ SWIGINTERN PyObject *_wrap_semanage_user_key_create(PyObject *SWIGUNUSEDPARM(sel
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_user_key_create" "', argument " "2"" of type '" "char const *""'");
+   }
+   arg2 = (char *)(buf2);
+-  result = (int)semanage_user_key_create(arg1,(char const *)arg2,arg3);
++  {
++    result = (int)semanage_user_key_create(arg1,(char const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_user_key, 0));
+@@ -6668,7 +7173,13 @@ SWIGINTERN PyObject *_wrap_semanage_user_key_extract(PyObject *SWIGUNUSEDPARM(se
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_user_key_extract" "', argument " "2"" of type '" "semanage_user_t const *""'"); 
+   }
+   arg2 = (semanage_user_t *)(argp2);
+-  result = (int)semanage_user_key_extract(arg1,(struct semanage_user const *)arg2,arg3);
++  {
++    result = (int)semanage_user_key_extract(arg1,(struct semanage_user const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_user_key, 0));
+@@ -6723,7 +7234,13 @@ SWIGINTERN PyObject *_wrap_semanage_user_compare(PyObject *SWIGUNUSEDPARM(self),
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_user_compare" "', argument " "2"" of type '" "semanage_user_key_t const *""'"); 
+   }
+   arg2 = (semanage_user_key_t *)(argp2);
+-  result = (int)semanage_user_compare((struct semanage_user const *)arg1,(struct semanage_user_key const *)arg2);
++  {
++    result = (int)semanage_user_compare((struct semanage_user const *)arg1,(struct semanage_user_key const *)arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -6754,7 +7271,13 @@ SWIGINTERN PyObject *_wrap_semanage_user_compare2(PyObject *SWIGUNUSEDPARM(self)
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_user_compare2" "', argument " "2"" of type '" "semanage_user_t const *""'"); 
+   }
+   arg2 = (semanage_user_t *)(argp2);
+-  result = (int)semanage_user_compare2((struct semanage_user const *)arg1,(struct semanage_user const *)arg2);
++  {
++    result = (int)semanage_user_compare2((struct semanage_user const *)arg1,(struct semanage_user const *)arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -6817,7 +7340,13 @@ SWIGINTERN PyObject *_wrap_semanage_user_set_name(PyObject *SWIGUNUSEDPARM(self)
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_user_set_name" "', argument " "3"" of type '" "char const *""'");
+   }
+   arg3 = (char *)(buf3);
+-  result = (int)semanage_user_set_name(arg1,arg2,(char const *)arg3);
++  {
++    result = (int)semanage_user_set_name(arg1,arg2,(char const *)arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
+   return resultobj;
+@@ -6882,7 +7411,13 @@ SWIGINTERN PyObject *_wrap_semanage_user_set_prefix(PyObject *SWIGUNUSEDPARM(sel
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_user_set_prefix" "', argument " "3"" of type '" "char const *""'");
+   }
+   arg3 = (char *)(buf3);
+-  result = (int)semanage_user_set_prefix(arg1,arg2,(char const *)arg3);
++  {
++    result = (int)semanage_user_set_prefix(arg1,arg2,(char const *)arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
+   return resultobj;
+@@ -6947,7 +7482,13 @@ SWIGINTERN PyObject *_wrap_semanage_user_set_mlslevel(PyObject *SWIGUNUSEDPARM(s
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_user_set_mlslevel" "', argument " "3"" of type '" "char const *""'");
+   }
+   arg3 = (char *)(buf3);
+-  result = (int)semanage_user_set_mlslevel(arg1,arg2,(char const *)arg3);
++  {
++    result = (int)semanage_user_set_mlslevel(arg1,arg2,(char const *)arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
+   return resultobj;
+@@ -7012,7 +7553,13 @@ SWIGINTERN PyObject *_wrap_semanage_user_set_mlsrange(PyObject *SWIGUNUSEDPARM(s
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_user_set_mlsrange" "', argument " "3"" of type '" "char const *""'");
+   }
+   arg3 = (char *)(buf3);
+-  result = (int)semanage_user_set_mlsrange(arg1,arg2,(char const *)arg3);
++  {
++    result = (int)semanage_user_set_mlsrange(arg1,arg2,(char const *)arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
+   return resultobj;
+@@ -7036,7 +7583,13 @@ SWIGINTERN PyObject *_wrap_semanage_user_get_num_roles(PyObject *SWIGUNUSEDPARM(
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_user_get_num_roles" "', argument " "1"" of type '" "semanage_user_t const *""'"); 
+   }
+   arg1 = (semanage_user_t *)(argp1);
+-  result = (int)semanage_user_get_num_roles((struct semanage_user const *)arg1);
++  {
++    result = (int)semanage_user_get_num_roles((struct semanage_user const *)arg1); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -7077,7 +7630,13 @@ SWIGINTERN PyObject *_wrap_semanage_user_add_role(PyObject *SWIGUNUSEDPARM(self)
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_user_add_role" "', argument " "3"" of type '" "char const *""'");
+   }
+   arg3 = (char *)(buf3);
+-  result = (int)semanage_user_add_role(arg1,arg2,(char const *)arg3);
++  {
++    result = (int)semanage_user_add_role(arg1,arg2,(char const *)arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
+   return resultobj;
+@@ -7144,7 +7703,13 @@ SWIGINTERN PyObject *_wrap_semanage_user_has_role(PyObject *SWIGUNUSEDPARM(self)
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_user_has_role" "', argument " "2"" of type '" "char const *""'");
+   }
+   arg2 = (char *)(buf2);
+-  result = (int)semanage_user_has_role((struct semanage_user const *)arg1,(char const *)arg2);
++  {
++    result = (int)semanage_user_has_role((struct semanage_user const *)arg1,(char const *)arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+   return resultobj;
+@@ -7186,7 +7751,13 @@ SWIGINTERN PyObject *_wrap_semanage_user_get_roles(PyObject *SWIGUNUSEDPARM(self
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_user_get_roles" "', argument " "2"" of type '" "semanage_user_t const *""'"); 
+   }
+   arg2 = (semanage_user_t *)(argp2);
+-  result = (int)semanage_user_get_roles(arg1,(struct semanage_user const *)arg2,(char const ***)arg3,arg4);
++  {
++    result = (int)semanage_user_get_roles(arg1,(struct semanage_user const *)arg2,(char const ***)arg3,arg4); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     if (resultobj) {
+@@ -7245,7 +7816,13 @@ SWIGINTERN PyObject *_wrap_semanage_user_set_roles(PyObject *SWIGUNUSEDPARM(self
+     SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "semanage_user_set_roles" "', argument " "4"" of type '" "unsigned int""'");
+   } 
+   arg4 = (unsigned int)(val4);
+-  result = (int)semanage_user_set_roles(arg1,arg2,(char const **)arg3,arg4);
++  {
++    result = (int)semanage_user_set_roles(arg1,arg2,(char const **)arg3,arg4); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(*arg3));
+@@ -7276,7 +7853,13 @@ SWIGINTERN PyObject *_wrap_semanage_user_create(PyObject *SWIGUNUSEDPARM(self),
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_user_create" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_user_create(arg1,arg2);
++  {
++    result = (int)semanage_user_create(arg1,arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg2, SWIGTYPE_p_semanage_user, 0));
+@@ -7315,7 +7898,13 @@ SWIGINTERN PyObject *_wrap_semanage_user_clone(PyObject *SWIGUNUSEDPARM(self), P
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_user_clone" "', argument " "2"" of type '" "semanage_user_t const *""'"); 
+   }
+   arg2 = (semanage_user_t *)(argp2);
+-  result = (int)semanage_user_clone(arg1,(struct semanage_user const *)arg2,arg3);
++  {
++    result = (int)semanage_user_clone(arg1,(struct semanage_user const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_user, 0));
+@@ -7379,7 +7968,13 @@ SWIGINTERN PyObject *_wrap_semanage_user_modify_local(PyObject *SWIGUNUSEDPARM(s
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_user_modify_local" "', argument " "3"" of type '" "semanage_user_t const *""'"); 
+   }
+   arg3 = (semanage_user_t *)(argp3);
+-  result = (int)semanage_user_modify_local(arg1,(struct semanage_user_key const *)arg2,(struct semanage_user const *)arg3);
++  {
++    result = (int)semanage_user_modify_local(arg1,(struct semanage_user_key const *)arg2,(struct semanage_user const *)arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -7410,7 +8005,13 @@ SWIGINTERN PyObject *_wrap_semanage_user_del_local(PyObject *SWIGUNUSEDPARM(self
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_user_del_local" "', argument " "2"" of type '" "semanage_user_key_t const *""'"); 
+   }
+   arg2 = (semanage_user_key_t *)(argp2);
+-  result = (int)semanage_user_del_local(arg1,(struct semanage_user_key const *)arg2);
++  {
++    result = (int)semanage_user_del_local(arg1,(struct semanage_user_key const *)arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -7446,7 +8047,13 @@ SWIGINTERN PyObject *_wrap_semanage_user_query_local(PyObject *SWIGUNUSEDPARM(se
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_user_query_local" "', argument " "2"" of type '" "semanage_user_key_t const *""'"); 
+   }
+   arg2 = (semanage_user_key_t *)(argp2);
+-  result = (int)semanage_user_query_local(arg1,(struct semanage_user_key const *)arg2,arg3);
++  {
++    result = (int)semanage_user_query_local(arg1,(struct semanage_user_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_user, 0));
+@@ -7484,7 +8091,13 @@ SWIGINTERN PyObject *_wrap_semanage_user_exists_local(PyObject *SWIGUNUSEDPARM(s
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_user_exists_local" "', argument " "2"" of type '" "semanage_user_key_t const *""'"); 
+   }
+   arg2 = (semanage_user_key_t *)(argp2);
+-  result = (int)semanage_user_exists_local(arg1,(struct semanage_user_key const *)arg2,arg3);
++  {
++    result = (int)semanage_user_exists_local(arg1,(struct semanage_user_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (SWIG_IsTmpObj(res3)) {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3)));
+@@ -7516,7 +8129,13 @@ SWIGINTERN PyObject *_wrap_semanage_user_count_local(PyObject *SWIGUNUSEDPARM(se
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_user_count_local" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_user_count_local(arg1,arg2);
++  {
++    result = (int)semanage_user_count_local(arg1,arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (SWIG_IsTmpObj(res2)) {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg2)));
+@@ -7559,7 +8178,13 @@ SWIGINTERN PyObject *_wrap_semanage_user_iterate_local(PyObject *SWIGUNUSEDPARM(
+   if (!SWIG_IsOK(res3)) {
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_user_iterate_local" "', argument " "3"" of type '" "void *""'"); 
+   }
+-  result = (int)semanage_user_iterate_local(arg1,arg2,arg3);
++  {
++    result = (int)semanage_user_iterate_local(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -7590,7 +8215,13 @@ SWIGINTERN PyObject *_wrap_semanage_user_list_local(PyObject *SWIGUNUSEDPARM(sel
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_user_list_local" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_user_list_local(arg1,arg2,arg3);
++  {
++    result = (int)semanage_user_list_local(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     if (resultobj) {
+@@ -7640,7 +8271,13 @@ SWIGINTERN PyObject *_wrap_semanage_user_query(PyObject *SWIGUNUSEDPARM(self), P
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_user_query" "', argument " "2"" of type '" "semanage_user_key_t const *""'"); 
+   }
+   arg2 = (semanage_user_key_t *)(argp2);
+-  result = (int)semanage_user_query(arg1,(struct semanage_user_key const *)arg2,arg3);
++  {
++    result = (int)semanage_user_query(arg1,(struct semanage_user_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_user, 0));
+@@ -7678,7 +8315,13 @@ SWIGINTERN PyObject *_wrap_semanage_user_exists(PyObject *SWIGUNUSEDPARM(self),
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_user_exists" "', argument " "2"" of type '" "semanage_user_key_t const *""'"); 
+   }
+   arg2 = (semanage_user_key_t *)(argp2);
+-  result = (int)semanage_user_exists(arg1,(struct semanage_user_key const *)arg2,arg3);
++  {
++    result = (int)semanage_user_exists(arg1,(struct semanage_user_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (SWIG_IsTmpObj(res3)) {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3)));
+@@ -7710,7 +8353,13 @@ SWIGINTERN PyObject *_wrap_semanage_user_count(PyObject *SWIGUNUSEDPARM(self), P
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_user_count" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_user_count(arg1,arg2);
++  {
++    result = (int)semanage_user_count(arg1,arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (SWIG_IsTmpObj(res2)) {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg2)));
+@@ -7753,7 +8402,13 @@ SWIGINTERN PyObject *_wrap_semanage_user_iterate(PyObject *SWIGUNUSEDPARM(self),
+   if (!SWIG_IsOK(res3)) {
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_user_iterate" "', argument " "3"" of type '" "void *""'"); 
+   }
+-  result = (int)semanage_user_iterate(arg1,arg2,arg3);
++  {
++    result = (int)semanage_user_iterate(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -7784,7 +8439,13 @@ SWIGINTERN PyObject *_wrap_semanage_user_list(PyObject *SWIGUNUSEDPARM(self), Py
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_user_list" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_user_list(arg1,arg2,arg3);
++  {
++    result = (int)semanage_user_list(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     if (resultobj) {
+@@ -7829,7 +8490,13 @@ SWIGINTERN PyObject *_wrap_semanage_port_compare(PyObject *SWIGUNUSEDPARM(self),
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_port_compare" "', argument " "2"" of type '" "semanage_port_key_t const *""'"); 
+   }
+   arg2 = (semanage_port_key_t *)(argp2);
+-  result = (int)semanage_port_compare((struct semanage_port const *)arg1,(struct semanage_port_key const *)arg2);
++  {
++    result = (int)semanage_port_compare((struct semanage_port const *)arg1,(struct semanage_port_key const *)arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -7860,7 +8527,13 @@ SWIGINTERN PyObject *_wrap_semanage_port_compare2(PyObject *SWIGUNUSEDPARM(self)
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_port_compare2" "', argument " "2"" of type '" "semanage_port_t const *""'"); 
+   }
+   arg2 = (semanage_port_t *)(argp2);
+-  result = (int)semanage_port_compare2((struct semanage_port const *)arg1,(struct semanage_port const *)arg2);
++  {
++    result = (int)semanage_port_compare2((struct semanage_port const *)arg1,(struct semanage_port const *)arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -7914,7 +8587,13 @@ SWIGINTERN PyObject *_wrap_semanage_port_key_create(PyObject *SWIGUNUSEDPARM(sel
+     SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "semanage_port_key_create" "', argument " "4"" of type '" "int""'");
+   } 
+   arg4 = (int)(val4);
+-  result = (int)semanage_port_key_create(arg1,arg2,arg3,arg4,arg5);
++  {
++    result = (int)semanage_port_key_create(arg1,arg2,arg3,arg4,arg5); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg5, SWIGTYPE_p_semanage_port_key, 0));
+@@ -7953,7 +8632,13 @@ SWIGINTERN PyObject *_wrap_semanage_port_key_extract(PyObject *SWIGUNUSEDPARM(se
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_port_key_extract" "', argument " "2"" of type '" "semanage_port_t const *""'"); 
+   }
+   arg2 = (semanage_port_t *)(argp2);
+-  result = (int)semanage_port_key_extract(arg1,(struct semanage_port const *)arg2,arg3);
++  {
++    result = (int)semanage_port_key_extract(arg1,(struct semanage_port const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_port_key, 0));
+@@ -7999,7 +8684,13 @@ SWIGINTERN PyObject *_wrap_semanage_port_get_proto(PyObject *SWIGUNUSEDPARM(self
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_port_get_proto" "', argument " "1"" of type '" "semanage_port_t const *""'"); 
+   }
+   arg1 = (semanage_port_t *)(argp1);
+-  result = (int)semanage_port_get_proto((struct semanage_port const *)arg1);
++  {
++    result = (int)semanage_port_get_proto((struct semanage_port const *)arg1); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -8073,7 +8764,13 @@ SWIGINTERN PyObject *_wrap_semanage_port_get_low(PyObject *SWIGUNUSEDPARM(self),
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_port_get_low" "', argument " "1"" of type '" "semanage_port_t const *""'"); 
+   }
+   arg1 = (semanage_port_t *)(argp1);
+-  result = (int)semanage_port_get_low((struct semanage_port const *)arg1);
++  {
++    result = (int)semanage_port_get_low((struct semanage_port const *)arg1); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -8095,7 +8792,13 @@ SWIGINTERN PyObject *_wrap_semanage_port_get_high(PyObject *SWIGUNUSEDPARM(self)
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_port_get_high" "', argument " "1"" of type '" "semanage_port_t const *""'"); 
+   }
+   arg1 = (semanage_port_t *)(argp1);
+-  result = (int)semanage_port_get_high((struct semanage_port const *)arg1);
++  {
++    result = (int)semanage_port_get_high((struct semanage_port const *)arg1); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -8226,7 +8929,13 @@ SWIGINTERN PyObject *_wrap_semanage_port_set_con(PyObject *SWIGUNUSEDPARM(self),
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_port_set_con" "', argument " "3"" of type '" "semanage_context_t *""'"); 
+   }
+   arg3 = (semanage_context_t *)(argp3);
+-  result = (int)semanage_port_set_con(arg1,arg2,arg3);
++  {
++    result = (int)semanage_port_set_con(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -8253,7 +8962,13 @@ SWIGINTERN PyObject *_wrap_semanage_port_create(PyObject *SWIGUNUSEDPARM(self),
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_port_create" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_port_create(arg1,arg2);
++  {
++    result = (int)semanage_port_create(arg1,arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg2, SWIGTYPE_p_semanage_port, 0));
+@@ -8292,7 +9007,13 @@ SWIGINTERN PyObject *_wrap_semanage_port_clone(PyObject *SWIGUNUSEDPARM(self), P
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_port_clone" "', argument " "2"" of type '" "semanage_port_t const *""'"); 
+   }
+   arg2 = (semanage_port_t *)(argp2);
+-  result = (int)semanage_port_clone(arg1,(struct semanage_port const *)arg2,arg3);
++  {
++    result = (int)semanage_port_clone(arg1,(struct semanage_port const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_port, 0));
+@@ -8356,7 +9077,13 @@ SWIGINTERN PyObject *_wrap_semanage_port_modify_local(PyObject *SWIGUNUSEDPARM(s
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_port_modify_local" "', argument " "3"" of type '" "semanage_port_t const *""'"); 
+   }
+   arg3 = (semanage_port_t *)(argp3);
+-  result = (int)semanage_port_modify_local(arg1,(struct semanage_port_key const *)arg2,(struct semanage_port const *)arg3);
++  {
++    result = (int)semanage_port_modify_local(arg1,(struct semanage_port_key const *)arg2,(struct semanage_port const *)arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -8387,7 +9114,13 @@ SWIGINTERN PyObject *_wrap_semanage_port_del_local(PyObject *SWIGUNUSEDPARM(self
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_port_del_local" "', argument " "2"" of type '" "semanage_port_key_t const *""'"); 
+   }
+   arg2 = (semanage_port_key_t *)(argp2);
+-  result = (int)semanage_port_del_local(arg1,(struct semanage_port_key const *)arg2);
++  {
++    result = (int)semanage_port_del_local(arg1,(struct semanage_port_key const *)arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -8423,7 +9156,13 @@ SWIGINTERN PyObject *_wrap_semanage_port_query_local(PyObject *SWIGUNUSEDPARM(se
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_port_query_local" "', argument " "2"" of type '" "semanage_port_key_t const *""'"); 
+   }
+   arg2 = (semanage_port_key_t *)(argp2);
+-  result = (int)semanage_port_query_local(arg1,(struct semanage_port_key const *)arg2,arg3);
++  {
++    result = (int)semanage_port_query_local(arg1,(struct semanage_port_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_port, 0));
+@@ -8461,7 +9200,13 @@ SWIGINTERN PyObject *_wrap_semanage_port_exists_local(PyObject *SWIGUNUSEDPARM(s
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_port_exists_local" "', argument " "2"" of type '" "semanage_port_key_t const *""'"); 
+   }
+   arg2 = (semanage_port_key_t *)(argp2);
+-  result = (int)semanage_port_exists_local(arg1,(struct semanage_port_key const *)arg2,arg3);
++  {
++    result = (int)semanage_port_exists_local(arg1,(struct semanage_port_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (SWIG_IsTmpObj(res3)) {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3)));
+@@ -8493,7 +9238,13 @@ SWIGINTERN PyObject *_wrap_semanage_port_count_local(PyObject *SWIGUNUSEDPARM(se
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_port_count_local" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_port_count_local(arg1,arg2);
++  {
++    result = (int)semanage_port_count_local(arg1,arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (SWIG_IsTmpObj(res2)) {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg2)));
+@@ -8536,7 +9287,13 @@ SWIGINTERN PyObject *_wrap_semanage_port_iterate_local(PyObject *SWIGUNUSEDPARM(
+   if (!SWIG_IsOK(res3)) {
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_port_iterate_local" "', argument " "3"" of type '" "void *""'"); 
+   }
+-  result = (int)semanage_port_iterate_local(arg1,arg2,arg3);
++  {
++    result = (int)semanage_port_iterate_local(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -8567,7 +9324,13 @@ SWIGINTERN PyObject *_wrap_semanage_port_list_local(PyObject *SWIGUNUSEDPARM(sel
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_port_list_local" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_port_list_local(arg1,arg2,arg3);
++  {
++    result = (int)semanage_port_list_local(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     if (resultobj) {
+@@ -8617,7 +9380,13 @@ SWIGINTERN PyObject *_wrap_semanage_port_query(PyObject *SWIGUNUSEDPARM(self), P
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_port_query" "', argument " "2"" of type '" "semanage_port_key_t const *""'"); 
+   }
+   arg2 = (semanage_port_key_t *)(argp2);
+-  result = (int)semanage_port_query(arg1,(struct semanage_port_key const *)arg2,arg3);
++  {
++    result = (int)semanage_port_query(arg1,(struct semanage_port_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_port, 0));
+@@ -8655,10 +9424,16 @@ SWIGINTERN PyObject *_wrap_semanage_port_exists(PyObject *SWIGUNUSEDPARM(self),
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_port_exists" "', argument " "2"" of type '" "semanage_port_key_t const *""'"); 
+   }
+   arg2 = (semanage_port_key_t *)(argp2);
+-  result = (int)semanage_port_exists(arg1,(struct semanage_port_key const *)arg2,arg3);
+-  resultobj = SWIG_From_int((int)(result));
+-  if (SWIG_IsTmpObj(res3)) {
+-    resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3)));
++  {
++    result = (int)semanage_port_exists(arg1,(struct semanage_port_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
++  resultobj = SWIG_From_int((int)(result));
++  if (SWIG_IsTmpObj(res3)) {
++    resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3)));
+   } else {
+     int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags));
+@@ -8687,7 +9462,13 @@ SWIGINTERN PyObject *_wrap_semanage_port_count(PyObject *SWIGUNUSEDPARM(self), P
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_port_count" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_port_count(arg1,arg2);
++  {
++    result = (int)semanage_port_count(arg1,arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (SWIG_IsTmpObj(res2)) {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg2)));
+@@ -8730,7 +9511,13 @@ SWIGINTERN PyObject *_wrap_semanage_port_iterate(PyObject *SWIGUNUSEDPARM(self),
+   if (!SWIG_IsOK(res3)) {
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_port_iterate" "', argument " "3"" of type '" "void *""'"); 
+   }
+-  result = (int)semanage_port_iterate(arg1,arg2,arg3);
++  {
++    result = (int)semanage_port_iterate(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -8761,7 +9548,13 @@ SWIGINTERN PyObject *_wrap_semanage_port_list(PyObject *SWIGUNUSEDPARM(self), Py
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_port_list" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_port_list(arg1,arg2,arg3);
++  {
++    result = (int)semanage_port_list(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     if (resultobj) {
+@@ -8806,7 +9599,13 @@ SWIGINTERN PyObject *_wrap_semanage_fcontext_compare(PyObject *SWIGUNUSEDPARM(se
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_fcontext_compare" "', argument " "2"" of type '" "semanage_fcontext_key_t const *""'"); 
+   }
+   arg2 = (semanage_fcontext_key_t *)(argp2);
+-  result = (int)semanage_fcontext_compare((struct semanage_fcontext const *)arg1,(struct semanage_fcontext_key const *)arg2);
++  {
++    result = (int)semanage_fcontext_compare((struct semanage_fcontext const *)arg1,(struct semanage_fcontext_key const *)arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -8837,7 +9636,13 @@ SWIGINTERN PyObject *_wrap_semanage_fcontext_compare2(PyObject *SWIGUNUSEDPARM(s
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_fcontext_compare2" "', argument " "2"" of type '" "semanage_fcontext_t const *""'"); 
+   }
+   arg2 = (semanage_fcontext_t *)(argp2);
+-  result = (int)semanage_fcontext_compare2((struct semanage_fcontext const *)arg1,(struct semanage_fcontext const *)arg2);
++  {
++    result = (int)semanage_fcontext_compare2((struct semanage_fcontext const *)arg1,(struct semanage_fcontext const *)arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -8883,7 +9688,13 @@ SWIGINTERN PyObject *_wrap_semanage_fcontext_key_create(PyObject *SWIGUNUSEDPARM
+     SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "semanage_fcontext_key_create" "', argument " "3"" of type '" "int""'");
+   } 
+   arg3 = (int)(val3);
+-  result = (int)semanage_fcontext_key_create(arg1,(char const *)arg2,arg3,arg4);
++  {
++    result = (int)semanage_fcontext_key_create(arg1,(char const *)arg2,arg3,arg4); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg4, SWIGTYPE_p_semanage_fcontext_key, 0));
+@@ -8924,7 +9735,13 @@ SWIGINTERN PyObject *_wrap_semanage_fcontext_key_extract(PyObject *SWIGUNUSEDPAR
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_fcontext_key_extract" "', argument " "2"" of type '" "semanage_fcontext_t const *""'"); 
+   }
+   arg2 = (semanage_fcontext_t *)(argp2);
+-  result = (int)semanage_fcontext_key_extract(arg1,(struct semanage_fcontext const *)arg2,arg3);
++  {
++    result = (int)semanage_fcontext_key_extract(arg1,(struct semanage_fcontext const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_fcontext_key, 0));
+@@ -9011,7 +9828,13 @@ SWIGINTERN PyObject *_wrap_semanage_fcontext_set_expr(PyObject *SWIGUNUSEDPARM(s
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_fcontext_set_expr" "', argument " "3"" of type '" "char const *""'");
+   }
+   arg3 = (char *)(buf3);
+-  result = (int)semanage_fcontext_set_expr(arg1,arg2,(char const *)arg3);
++  {
++    result = (int)semanage_fcontext_set_expr(arg1,arg2,(char const *)arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
+   return resultobj;
+@@ -9035,7 +9858,13 @@ SWIGINTERN PyObject *_wrap_semanage_fcontext_get_type(PyObject *SWIGUNUSEDPARM(s
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_fcontext_get_type" "', argument " "1"" of type '" "semanage_fcontext_t const *""'"); 
+   }
+   arg1 = (semanage_fcontext_t *)(argp1);
+-  result = (int)semanage_fcontext_get_type((struct semanage_fcontext const *)arg1);
++  {
++    result = (int)semanage_fcontext_get_type((struct semanage_fcontext const *)arg1); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -9149,7 +9978,13 @@ SWIGINTERN PyObject *_wrap_semanage_fcontext_set_con(PyObject *SWIGUNUSEDPARM(se
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_fcontext_set_con" "', argument " "3"" of type '" "semanage_context_t *""'"); 
+   }
+   arg3 = (semanage_context_t *)(argp3);
+-  result = (int)semanage_fcontext_set_con(arg1,arg2,arg3);
++  {
++    result = (int)semanage_fcontext_set_con(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -9176,7 +10011,13 @@ SWIGINTERN PyObject *_wrap_semanage_fcontext_create(PyObject *SWIGUNUSEDPARM(sel
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_fcontext_create" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_fcontext_create(arg1,arg2);
++  {
++    result = (int)semanage_fcontext_create(arg1,arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg2, SWIGTYPE_p_semanage_fcontext, 0));
+@@ -9215,7 +10056,13 @@ SWIGINTERN PyObject *_wrap_semanage_fcontext_clone(PyObject *SWIGUNUSEDPARM(self
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_fcontext_clone" "', argument " "2"" of type '" "semanage_fcontext_t const *""'"); 
+   }
+   arg2 = (semanage_fcontext_t *)(argp2);
+-  result = (int)semanage_fcontext_clone(arg1,(struct semanage_fcontext const *)arg2,arg3);
++  {
++    result = (int)semanage_fcontext_clone(arg1,(struct semanage_fcontext const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_fcontext, 0));
+@@ -9279,7 +10126,13 @@ SWIGINTERN PyObject *_wrap_semanage_fcontext_modify_local(PyObject *SWIGUNUSEDPA
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_fcontext_modify_local" "', argument " "3"" of type '" "semanage_fcontext_t const *""'"); 
+   }
+   arg3 = (semanage_fcontext_t *)(argp3);
+-  result = (int)semanage_fcontext_modify_local(arg1,(struct semanage_fcontext_key const *)arg2,(struct semanage_fcontext const *)arg3);
++  {
++    result = (int)semanage_fcontext_modify_local(arg1,(struct semanage_fcontext_key const *)arg2,(struct semanage_fcontext const *)arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -9310,7 +10163,13 @@ SWIGINTERN PyObject *_wrap_semanage_fcontext_del_local(PyObject *SWIGUNUSEDPARM(
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_fcontext_del_local" "', argument " "2"" of type '" "semanage_fcontext_key_t const *""'"); 
+   }
+   arg2 = (semanage_fcontext_key_t *)(argp2);
+-  result = (int)semanage_fcontext_del_local(arg1,(struct semanage_fcontext_key const *)arg2);
++  {
++    result = (int)semanage_fcontext_del_local(arg1,(struct semanage_fcontext_key const *)arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -9346,7 +10205,13 @@ SWIGINTERN PyObject *_wrap_semanage_fcontext_query_local(PyObject *SWIGUNUSEDPAR
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_fcontext_query_local" "', argument " "2"" of type '" "semanage_fcontext_key_t const *""'"); 
+   }
+   arg2 = (semanage_fcontext_key_t *)(argp2);
+-  result = (int)semanage_fcontext_query_local(arg1,(struct semanage_fcontext_key const *)arg2,arg3);
++  {
++    result = (int)semanage_fcontext_query_local(arg1,(struct semanage_fcontext_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_fcontext, 0));
+@@ -9384,7 +10249,13 @@ SWIGINTERN PyObject *_wrap_semanage_fcontext_exists_local(PyObject *SWIGUNUSEDPA
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_fcontext_exists_local" "', argument " "2"" of type '" "semanage_fcontext_key_t const *""'"); 
+   }
+   arg2 = (semanage_fcontext_key_t *)(argp2);
+-  result = (int)semanage_fcontext_exists_local(arg1,(struct semanage_fcontext_key const *)arg2,arg3);
++  {
++    result = (int)semanage_fcontext_exists_local(arg1,(struct semanage_fcontext_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (SWIG_IsTmpObj(res3)) {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3)));
+@@ -9416,7 +10287,13 @@ SWIGINTERN PyObject *_wrap_semanage_fcontext_count_local(PyObject *SWIGUNUSEDPAR
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_fcontext_count_local" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_fcontext_count_local(arg1,arg2);
++  {
++    result = (int)semanage_fcontext_count_local(arg1,arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (SWIG_IsTmpObj(res2)) {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg2)));
+@@ -9459,7 +10336,13 @@ SWIGINTERN PyObject *_wrap_semanage_fcontext_iterate_local(PyObject *SWIGUNUSEDP
+   if (!SWIG_IsOK(res3)) {
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_fcontext_iterate_local" "', argument " "3"" of type '" "void *""'"); 
+   }
+-  result = (int)semanage_fcontext_iterate_local(arg1,arg2,arg3);
++  {
++    result = (int)semanage_fcontext_iterate_local(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -9490,7 +10373,13 @@ SWIGINTERN PyObject *_wrap_semanage_fcontext_list_local(PyObject *SWIGUNUSEDPARM
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_fcontext_list_local" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_fcontext_list_local(arg1,arg2,arg3);
++  {
++    result = (int)semanage_fcontext_list_local(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     if (resultobj) {
+@@ -9540,7 +10429,13 @@ SWIGINTERN PyObject *_wrap_semanage_fcontext_query(PyObject *SWIGUNUSEDPARM(self
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_fcontext_query" "', argument " "2"" of type '" "semanage_fcontext_key_t const *""'"); 
+   }
+   arg2 = (semanage_fcontext_key_t *)(argp2);
+-  result = (int)semanage_fcontext_query(arg1,(struct semanage_fcontext_key const *)arg2,arg3);
++  {
++    result = (int)semanage_fcontext_query(arg1,(struct semanage_fcontext_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_fcontext, 0));
+@@ -9578,7 +10473,13 @@ SWIGINTERN PyObject *_wrap_semanage_fcontext_exists(PyObject *SWIGUNUSEDPARM(sel
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_fcontext_exists" "', argument " "2"" of type '" "semanage_fcontext_key_t const *""'"); 
+   }
+   arg2 = (semanage_fcontext_key_t *)(argp2);
+-  result = (int)semanage_fcontext_exists(arg1,(struct semanage_fcontext_key const *)arg2,arg3);
++  {
++    result = (int)semanage_fcontext_exists(arg1,(struct semanage_fcontext_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (SWIG_IsTmpObj(res3)) {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3)));
+@@ -9610,7 +10511,13 @@ SWIGINTERN PyObject *_wrap_semanage_fcontext_count(PyObject *SWIGUNUSEDPARM(self
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_fcontext_count" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_fcontext_count(arg1,arg2);
++  {
++    result = (int)semanage_fcontext_count(arg1,arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (SWIG_IsTmpObj(res2)) {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg2)));
+@@ -9653,7 +10560,13 @@ SWIGINTERN PyObject *_wrap_semanage_fcontext_iterate(PyObject *SWIGUNUSEDPARM(se
+   if (!SWIG_IsOK(res3)) {
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_fcontext_iterate" "', argument " "3"" of type '" "void *""'"); 
+   }
+-  result = (int)semanage_fcontext_iterate(arg1,arg2,arg3);
++  {
++    result = (int)semanage_fcontext_iterate(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -9684,7 +10597,13 @@ SWIGINTERN PyObject *_wrap_semanage_fcontext_list(PyObject *SWIGUNUSEDPARM(self)
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_fcontext_list" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_fcontext_list(arg1,arg2,arg3);
++  {
++    result = (int)semanage_fcontext_list(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     if (resultobj) {
+@@ -9735,7 +10654,13 @@ SWIGINTERN PyObject *_wrap_semanage_seuser_key_create(PyObject *SWIGUNUSEDPARM(s
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_seuser_key_create" "', argument " "2"" of type '" "char const *""'");
+   }
+   arg2 = (char *)(buf2);
+-  result = (int)semanage_seuser_key_create(arg1,(char const *)arg2,arg3);
++  {
++    result = (int)semanage_seuser_key_create(arg1,(char const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_seuser_key, 0));
+@@ -9776,7 +10701,13 @@ SWIGINTERN PyObject *_wrap_semanage_seuser_key_extract(PyObject *SWIGUNUSEDPARM(
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_seuser_key_extract" "', argument " "2"" of type '" "semanage_seuser_t const *""'"); 
+   }
+   arg2 = (semanage_seuser_t *)(argp2);
+-  result = (int)semanage_seuser_key_extract(arg1,(struct semanage_seuser const *)arg2,arg3);
++  {
++    result = (int)semanage_seuser_key_extract(arg1,(struct semanage_seuser const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_seuser_key, 0));
+@@ -9831,7 +10762,13 @@ SWIGINTERN PyObject *_wrap_semanage_seuser_compare(PyObject *SWIGUNUSEDPARM(self
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_seuser_compare" "', argument " "2"" of type '" "semanage_seuser_key_t const *""'"); 
+   }
+   arg2 = (semanage_seuser_key_t *)(argp2);
+-  result = (int)semanage_seuser_compare((struct semanage_seuser const *)arg1,(struct semanage_seuser_key const *)arg2);
++  {
++    result = (int)semanage_seuser_compare((struct semanage_seuser const *)arg1,(struct semanage_seuser_key const *)arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -9862,7 +10799,13 @@ SWIGINTERN PyObject *_wrap_semanage_seuser_compare2(PyObject *SWIGUNUSEDPARM(sel
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_seuser_compare2" "', argument " "2"" of type '" "semanage_seuser_t const *""'"); 
+   }
+   arg2 = (semanage_seuser_t *)(argp2);
+-  result = (int)semanage_seuser_compare2((struct semanage_seuser const *)arg1,(struct semanage_seuser const *)arg2);
++  {
++    result = (int)semanage_seuser_compare2((struct semanage_seuser const *)arg1,(struct semanage_seuser const *)arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -9925,7 +10868,13 @@ SWIGINTERN PyObject *_wrap_semanage_seuser_set_name(PyObject *SWIGUNUSEDPARM(sel
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_seuser_set_name" "', argument " "3"" of type '" "char const *""'");
+   }
+   arg3 = (char *)(buf3);
+-  result = (int)semanage_seuser_set_name(arg1,arg2,(char const *)arg3);
++  {
++    result = (int)semanage_seuser_set_name(arg1,arg2,(char const *)arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
+   return resultobj;
+@@ -9990,7 +10939,13 @@ SWIGINTERN PyObject *_wrap_semanage_seuser_set_sename(PyObject *SWIGUNUSEDPARM(s
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_seuser_set_sename" "', argument " "3"" of type '" "char const *""'");
+   }
+   arg3 = (char *)(buf3);
+-  result = (int)semanage_seuser_set_sename(arg1,arg2,(char const *)arg3);
++  {
++    result = (int)semanage_seuser_set_sename(arg1,arg2,(char const *)arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
+   return resultobj;
+@@ -10055,7 +11010,13 @@ SWIGINTERN PyObject *_wrap_semanage_seuser_set_mlsrange(PyObject *SWIGUNUSEDPARM
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_seuser_set_mlsrange" "', argument " "3"" of type '" "char const *""'");
+   }
+   arg3 = (char *)(buf3);
+-  result = (int)semanage_seuser_set_mlsrange(arg1,arg2,(char const *)arg3);
++  {
++    result = (int)semanage_seuser_set_mlsrange(arg1,arg2,(char const *)arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
+   return resultobj;
+@@ -10084,7 +11045,13 @@ SWIGINTERN PyObject *_wrap_semanage_seuser_create(PyObject *SWIGUNUSEDPARM(self)
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_seuser_create" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_seuser_create(arg1,arg2);
++  {
++    result = (int)semanage_seuser_create(arg1,arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg2, SWIGTYPE_p_semanage_seuser, 0));
+@@ -10123,7 +11090,13 @@ SWIGINTERN PyObject *_wrap_semanage_seuser_clone(PyObject *SWIGUNUSEDPARM(self),
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_seuser_clone" "', argument " "2"" of type '" "semanage_seuser_t const *""'"); 
+   }
+   arg2 = (semanage_seuser_t *)(argp2);
+-  result = (int)semanage_seuser_clone(arg1,(struct semanage_seuser const *)arg2,arg3);
++  {
++    result = (int)semanage_seuser_clone(arg1,(struct semanage_seuser const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_seuser, 0));
+@@ -10187,7 +11160,13 @@ SWIGINTERN PyObject *_wrap_semanage_seuser_modify_local(PyObject *SWIGUNUSEDPARM
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_seuser_modify_local" "', argument " "3"" of type '" "semanage_seuser_t const *""'"); 
+   }
+   arg3 = (semanage_seuser_t *)(argp3);
+-  result = (int)semanage_seuser_modify_local(arg1,(struct semanage_seuser_key const *)arg2,(struct semanage_seuser const *)arg3);
++  {
++    result = (int)semanage_seuser_modify_local(arg1,(struct semanage_seuser_key const *)arg2,(struct semanage_seuser const *)arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -10218,7 +11197,13 @@ SWIGINTERN PyObject *_wrap_semanage_seuser_del_local(PyObject *SWIGUNUSEDPARM(se
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_seuser_del_local" "', argument " "2"" of type '" "semanage_seuser_key_t const *""'"); 
+   }
+   arg2 = (semanage_seuser_key_t *)(argp2);
+-  result = (int)semanage_seuser_del_local(arg1,(struct semanage_seuser_key const *)arg2);
++  {
++    result = (int)semanage_seuser_del_local(arg1,(struct semanage_seuser_key const *)arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -10254,7 +11239,13 @@ SWIGINTERN PyObject *_wrap_semanage_seuser_query_local(PyObject *SWIGUNUSEDPARM(
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_seuser_query_local" "', argument " "2"" of type '" "semanage_seuser_key_t const *""'"); 
+   }
+   arg2 = (semanage_seuser_key_t *)(argp2);
+-  result = (int)semanage_seuser_query_local(arg1,(struct semanage_seuser_key const *)arg2,arg3);
++  {
++    result = (int)semanage_seuser_query_local(arg1,(struct semanage_seuser_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_seuser, 0));
+@@ -10292,7 +11283,13 @@ SWIGINTERN PyObject *_wrap_semanage_seuser_exists_local(PyObject *SWIGUNUSEDPARM
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_seuser_exists_local" "', argument " "2"" of type '" "semanage_seuser_key_t const *""'"); 
+   }
+   arg2 = (semanage_seuser_key_t *)(argp2);
+-  result = (int)semanage_seuser_exists_local(arg1,(struct semanage_seuser_key const *)arg2,arg3);
++  {
++    result = (int)semanage_seuser_exists_local(arg1,(struct semanage_seuser_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (SWIG_IsTmpObj(res3)) {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3)));
+@@ -10324,7 +11321,13 @@ SWIGINTERN PyObject *_wrap_semanage_seuser_count_local(PyObject *SWIGUNUSEDPARM(
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_seuser_count_local" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_seuser_count_local(arg1,arg2);
++  {
++    result = (int)semanage_seuser_count_local(arg1,arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (SWIG_IsTmpObj(res2)) {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg2)));
+@@ -10367,7 +11370,13 @@ SWIGINTERN PyObject *_wrap_semanage_seuser_iterate_local(PyObject *SWIGUNUSEDPAR
+   if (!SWIG_IsOK(res3)) {
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_seuser_iterate_local" "', argument " "3"" of type '" "void *""'"); 
+   }
+-  result = (int)semanage_seuser_iterate_local(arg1,arg2,arg3);
++  {
++    result = (int)semanage_seuser_iterate_local(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -10398,7 +11407,13 @@ SWIGINTERN PyObject *_wrap_semanage_seuser_list_local(PyObject *SWIGUNUSEDPARM(s
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_seuser_list_local" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_seuser_list_local(arg1,arg2,arg3);
++  {
++    result = (int)semanage_seuser_list_local(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     if (resultobj) {
+@@ -10448,7 +11463,13 @@ SWIGINTERN PyObject *_wrap_semanage_seuser_query(PyObject *SWIGUNUSEDPARM(self),
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_seuser_query" "', argument " "2"" of type '" "semanage_seuser_key_t const *""'"); 
+   }
+   arg2 = (semanage_seuser_key_t *)(argp2);
+-  result = (int)semanage_seuser_query(arg1,(struct semanage_seuser_key const *)arg2,arg3);
++  {
++    result = (int)semanage_seuser_query(arg1,(struct semanage_seuser_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_seuser, 0));
+@@ -10486,7 +11507,13 @@ SWIGINTERN PyObject *_wrap_semanage_seuser_exists(PyObject *SWIGUNUSEDPARM(self)
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_seuser_exists" "', argument " "2"" of type '" "semanage_seuser_key_t const *""'"); 
+   }
+   arg2 = (semanage_seuser_key_t *)(argp2);
+-  result = (int)semanage_seuser_exists(arg1,(struct semanage_seuser_key const *)arg2,arg3);
++  {
++    result = (int)semanage_seuser_exists(arg1,(struct semanage_seuser_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (SWIG_IsTmpObj(res3)) {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3)));
+@@ -10518,7 +11545,13 @@ SWIGINTERN PyObject *_wrap_semanage_seuser_count(PyObject *SWIGUNUSEDPARM(self),
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_seuser_count" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_seuser_count(arg1,arg2);
++  {
++    result = (int)semanage_seuser_count(arg1,arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (SWIG_IsTmpObj(res2)) {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg2)));
+@@ -10561,7 +11594,13 @@ SWIGINTERN PyObject *_wrap_semanage_seuser_iterate(PyObject *SWIGUNUSEDPARM(self
+   if (!SWIG_IsOK(res3)) {
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_seuser_iterate" "', argument " "3"" of type '" "void *""'"); 
+   }
+-  result = (int)semanage_seuser_iterate(arg1,arg2,arg3);
++  {
++    result = (int)semanage_seuser_iterate(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -10592,7 +11631,13 @@ SWIGINTERN PyObject *_wrap_semanage_seuser_list(PyObject *SWIGUNUSEDPARM(self),
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_seuser_list" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_seuser_list(arg1,arg2,arg3);
++  {
++    result = (int)semanage_seuser_list(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     if (resultobj) {
+@@ -10637,7 +11682,13 @@ SWIGINTERN PyObject *_wrap_semanage_node_compare(PyObject *SWIGUNUSEDPARM(self),
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_node_compare" "', argument " "2"" of type '" "semanage_node_key_t const *""'"); 
+   }
+   arg2 = (semanage_node_key_t *)(argp2);
+-  result = (int)semanage_node_compare((struct semanage_node const *)arg1,(struct semanage_node_key const *)arg2);
++  {
++    result = (int)semanage_node_compare((struct semanage_node const *)arg1,(struct semanage_node_key const *)arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -10668,7 +11719,13 @@ SWIGINTERN PyObject *_wrap_semanage_node_compare2(PyObject *SWIGUNUSEDPARM(self)
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_node_compare2" "', argument " "2"" of type '" "semanage_node_t const *""'"); 
+   }
+   arg2 = (semanage_node_t *)(argp2);
+-  result = (int)semanage_node_compare2((struct semanage_node const *)arg1,(struct semanage_node const *)arg2);
++  {
++    result = (int)semanage_node_compare2((struct semanage_node const *)arg1,(struct semanage_node const *)arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -10724,7 +11781,13 @@ SWIGINTERN PyObject *_wrap_semanage_node_key_create(PyObject *SWIGUNUSEDPARM(sel
+     SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "semanage_node_key_create" "', argument " "4"" of type '" "int""'");
+   } 
+   arg4 = (int)(val4);
+-  result = (int)semanage_node_key_create(arg1,(char const *)arg2,(char const *)arg3,arg4,arg5);
++  {
++    result = (int)semanage_node_key_create(arg1,(char const *)arg2,(char const *)arg3,arg4,arg5); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg5, SWIGTYPE_p_semanage_node_key, 0));
+@@ -10767,7 +11830,13 @@ SWIGINTERN PyObject *_wrap_semanage_node_key_extract(PyObject *SWIGUNUSEDPARM(se
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_node_key_extract" "', argument " "2"" of type '" "semanage_node_t const *""'"); 
+   }
+   arg2 = (semanage_node_t *)(argp2);
+-  result = (int)semanage_node_key_extract(arg1,(struct semanage_node const *)arg2,arg3);
++  {
++    result = (int)semanage_node_key_extract(arg1,(struct semanage_node const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_node_key, 0));
+@@ -10827,7 +11896,13 @@ SWIGINTERN PyObject *_wrap_semanage_node_get_addr(PyObject *SWIGUNUSEDPARM(self)
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_node_get_addr" "', argument " "2"" of type '" "semanage_node_t const *""'"); 
+   }
+   arg2 = (semanage_node_t *)(argp2);
+-  result = (int)semanage_node_get_addr(arg1,(struct semanage_node const *)arg2,arg3);
++  {
++    result = (int)semanage_node_get_addr(arg1,(struct semanage_node const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(*arg3));
+@@ -10871,7 +11946,13 @@ SWIGINTERN PyObject *_wrap_semanage_node_get_addr_bytes(PyObject *SWIGUNUSEDPARM
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_node_get_addr_bytes" "', argument " "2"" of type '" "semanage_node_t const *""'"); 
+   }
+   arg2 = (semanage_node_t *)(argp2);
+-  result = (int)semanage_node_get_addr_bytes(arg1,(struct semanage_node const *)arg2,arg3,arg4);
++  {
++    result = (int)semanage_node_get_addr_bytes(arg1,(struct semanage_node const *)arg2,arg3,arg4); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(*arg3));
+@@ -10931,7 +12012,13 @@ SWIGINTERN PyObject *_wrap_semanage_node_set_addr(PyObject *SWIGUNUSEDPARM(self)
+     SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "semanage_node_set_addr" "', argument " "4"" of type '" "char const *""'");
+   }
+   arg4 = (char *)(buf4);
+-  result = (int)semanage_node_set_addr(arg1,arg2,arg3,(char const *)arg4);
++  {
++    result = (int)semanage_node_set_addr(arg1,arg2,arg3,(char const *)arg4); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (alloc4 == SWIG_NEWOBJ) free((char*)buf4);
+   return resultobj;
+@@ -10983,7 +12070,13 @@ SWIGINTERN PyObject *_wrap_semanage_node_set_addr_bytes(PyObject *SWIGUNUSEDPARM
+     SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "semanage_node_set_addr_bytes" "', argument " "4"" of type '" "size_t""'");
+   } 
+   arg4 = (size_t)(val4);
+-  result = (int)semanage_node_set_addr_bytes(arg1,arg2,(char const *)arg3,arg4);
++  {
++    result = (int)semanage_node_set_addr_bytes(arg1,arg2,(char const *)arg3,arg4); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
+   return resultobj;
+@@ -11021,7 +12114,13 @@ SWIGINTERN PyObject *_wrap_semanage_node_get_mask(PyObject *SWIGUNUSEDPARM(self)
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_node_get_mask" "', argument " "2"" of type '" "semanage_node_t const *""'"); 
+   }
+   arg2 = (semanage_node_t *)(argp2);
+-  result = (int)semanage_node_get_mask(arg1,(struct semanage_node const *)arg2,arg3);
++  {
++    result = (int)semanage_node_get_mask(arg1,(struct semanage_node const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(*arg3));
+@@ -11065,7 +12164,13 @@ SWIGINTERN PyObject *_wrap_semanage_node_get_mask_bytes(PyObject *SWIGUNUSEDPARM
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_node_get_mask_bytes" "', argument " "2"" of type '" "semanage_node_t const *""'"); 
+   }
+   arg2 = (semanage_node_t *)(argp2);
+-  result = (int)semanage_node_get_mask_bytes(arg1,(struct semanage_node const *)arg2,arg3,arg4);
++  {
++    result = (int)semanage_node_get_mask_bytes(arg1,(struct semanage_node const *)arg2,arg3,arg4); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(*arg3));
+@@ -11125,7 +12230,13 @@ SWIGINTERN PyObject *_wrap_semanage_node_set_mask(PyObject *SWIGUNUSEDPARM(self)
+     SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "semanage_node_set_mask" "', argument " "4"" of type '" "char const *""'");
+   }
+   arg4 = (char *)(buf4);
+-  result = (int)semanage_node_set_mask(arg1,arg2,arg3,(char const *)arg4);
++  {
++    result = (int)semanage_node_set_mask(arg1,arg2,arg3,(char const *)arg4); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (alloc4 == SWIG_NEWOBJ) free((char*)buf4);
+   return resultobj;
+@@ -11177,7 +12288,13 @@ SWIGINTERN PyObject *_wrap_semanage_node_set_mask_bytes(PyObject *SWIGUNUSEDPARM
+     SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "semanage_node_set_mask_bytes" "', argument " "4"" of type '" "size_t""'");
+   } 
+   arg4 = (size_t)(val4);
+-  result = (int)semanage_node_set_mask_bytes(arg1,arg2,(char const *)arg3,arg4);
++  {
++    result = (int)semanage_node_set_mask_bytes(arg1,arg2,(char const *)arg3,arg4); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
+   return resultobj;
+@@ -11201,7 +12318,13 @@ SWIGINTERN PyObject *_wrap_semanage_node_get_proto(PyObject *SWIGUNUSEDPARM(self
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_node_get_proto" "', argument " "1"" of type '" "semanage_node_t const *""'"); 
+   }
+   arg1 = (semanage_node_t *)(argp1);
+-  result = (int)semanage_node_get_proto((struct semanage_node const *)arg1);
++  {
++    result = (int)semanage_node_get_proto((struct semanage_node const *)arg1); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -11315,7 +12438,13 @@ SWIGINTERN PyObject *_wrap_semanage_node_set_con(PyObject *SWIGUNUSEDPARM(self),
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_node_set_con" "', argument " "3"" of type '" "semanage_context_t *""'"); 
+   }
+   arg3 = (semanage_context_t *)(argp3);
+-  result = (int)semanage_node_set_con(arg1,arg2,arg3);
++  {
++    result = (int)semanage_node_set_con(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -11342,7 +12471,13 @@ SWIGINTERN PyObject *_wrap_semanage_node_create(PyObject *SWIGUNUSEDPARM(self),
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_node_create" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_node_create(arg1,arg2);
++  {
++    result = (int)semanage_node_create(arg1,arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg2, SWIGTYPE_p_semanage_node, 0));
+@@ -11381,7 +12516,13 @@ SWIGINTERN PyObject *_wrap_semanage_node_clone(PyObject *SWIGUNUSEDPARM(self), P
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_node_clone" "', argument " "2"" of type '" "semanage_node_t const *""'"); 
+   }
+   arg2 = (semanage_node_t *)(argp2);
+-  result = (int)semanage_node_clone(arg1,(struct semanage_node const *)arg2,arg3);
++  {
++    result = (int)semanage_node_clone(arg1,(struct semanage_node const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_node, 0));
+@@ -11445,7 +12586,13 @@ SWIGINTERN PyObject *_wrap_semanage_node_modify_local(PyObject *SWIGUNUSEDPARM(s
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_node_modify_local" "', argument " "3"" of type '" "semanage_node_t const *""'"); 
+   }
+   arg3 = (semanage_node_t *)(argp3);
+-  result = (int)semanage_node_modify_local(arg1,(struct semanage_node_key const *)arg2,(struct semanage_node const *)arg3);
++  {
++    result = (int)semanage_node_modify_local(arg1,(struct semanage_node_key const *)arg2,(struct semanage_node const *)arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -11476,7 +12623,13 @@ SWIGINTERN PyObject *_wrap_semanage_node_del_local(PyObject *SWIGUNUSEDPARM(self
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_node_del_local" "', argument " "2"" of type '" "semanage_node_key_t const *""'"); 
+   }
+   arg2 = (semanage_node_key_t *)(argp2);
+-  result = (int)semanage_node_del_local(arg1,(struct semanage_node_key const *)arg2);
++  {
++    result = (int)semanage_node_del_local(arg1,(struct semanage_node_key const *)arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -11512,7 +12665,13 @@ SWIGINTERN PyObject *_wrap_semanage_node_query_local(PyObject *SWIGUNUSEDPARM(se
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_node_query_local" "', argument " "2"" of type '" "semanage_node_key_t const *""'"); 
+   }
+   arg2 = (semanage_node_key_t *)(argp2);
+-  result = (int)semanage_node_query_local(arg1,(struct semanage_node_key const *)arg2,arg3);
++  {
++    result = (int)semanage_node_query_local(arg1,(struct semanage_node_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_node, 0));
+@@ -11550,7 +12709,13 @@ SWIGINTERN PyObject *_wrap_semanage_node_exists_local(PyObject *SWIGUNUSEDPARM(s
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_node_exists_local" "', argument " "2"" of type '" "semanage_node_key_t const *""'"); 
+   }
+   arg2 = (semanage_node_key_t *)(argp2);
+-  result = (int)semanage_node_exists_local(arg1,(struct semanage_node_key const *)arg2,arg3);
++  {
++    result = (int)semanage_node_exists_local(arg1,(struct semanage_node_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (SWIG_IsTmpObj(res3)) {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3)));
+@@ -11582,7 +12747,13 @@ SWIGINTERN PyObject *_wrap_semanage_node_count_local(PyObject *SWIGUNUSEDPARM(se
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_node_count_local" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_node_count_local(arg1,arg2);
++  {
++    result = (int)semanage_node_count_local(arg1,arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (SWIG_IsTmpObj(res2)) {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg2)));
+@@ -11625,7 +12796,13 @@ SWIGINTERN PyObject *_wrap_semanage_node_iterate_local(PyObject *SWIGUNUSEDPARM(
+   if (!SWIG_IsOK(res3)) {
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_node_iterate_local" "', argument " "3"" of type '" "void *""'"); 
+   }
+-  result = (int)semanage_node_iterate_local(arg1,arg2,arg3);
++  {
++    result = (int)semanage_node_iterate_local(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -11656,7 +12833,13 @@ SWIGINTERN PyObject *_wrap_semanage_node_list_local(PyObject *SWIGUNUSEDPARM(sel
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_node_list_local" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_node_list_local(arg1,arg2,arg3);
++  {
++    result = (int)semanage_node_list_local(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     if (resultobj) {
+@@ -11706,7 +12889,13 @@ SWIGINTERN PyObject *_wrap_semanage_node_query(PyObject *SWIGUNUSEDPARM(self), P
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_node_query" "', argument " "2"" of type '" "semanage_node_key_t const *""'"); 
+   }
+   arg2 = (semanage_node_key_t *)(argp2);
+-  result = (int)semanage_node_query(arg1,(struct semanage_node_key const *)arg2,arg3);
++  {
++    result = (int)semanage_node_query(arg1,(struct semanage_node_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_node, 0));
+@@ -11744,7 +12933,13 @@ SWIGINTERN PyObject *_wrap_semanage_node_exists(PyObject *SWIGUNUSEDPARM(self),
+     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "semanage_node_exists" "', argument " "2"" of type '" "semanage_node_key_t const *""'"); 
+   }
+   arg2 = (semanage_node_key_t *)(argp2);
+-  result = (int)semanage_node_exists(arg1,(struct semanage_node_key const *)arg2,arg3);
++  {
++    result = (int)semanage_node_exists(arg1,(struct semanage_node_key const *)arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (SWIG_IsTmpObj(res3)) {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3)));
+@@ -11776,7 +12971,13 @@ SWIGINTERN PyObject *_wrap_semanage_node_count(PyObject *SWIGUNUSEDPARM(self), P
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_node_count" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_node_count(arg1,arg2);
++  {
++    result = (int)semanage_node_count(arg1,arg2); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   if (SWIG_IsTmpObj(res2)) {
+     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg2)));
+@@ -11819,7 +13020,13 @@ SWIGINTERN PyObject *_wrap_semanage_node_iterate(PyObject *SWIGUNUSEDPARM(self),
+   if (!SWIG_IsOK(res3)) {
+     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "semanage_node_iterate" "', argument " "3"" of type '" "void *""'"); 
+   }
+-  result = (int)semanage_node_iterate(arg1,arg2,arg3);
++  {
++    result = (int)semanage_node_iterate(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   return resultobj;
+ fail:
+@@ -11850,7 +13057,13 @@ SWIGINTERN PyObject *_wrap_semanage_node_list(PyObject *SWIGUNUSEDPARM(self), Py
+     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_node_list" "', argument " "1"" of type '" "semanage_handle_t *""'"); 
+   }
+   arg1 = (semanage_handle_t *)(argp1);
+-  result = (int)semanage_node_list(arg1,arg2,arg3);
++  {
++    result = (int)semanage_node_list(arg1,arg2,arg3); 
++    if (result < 0) {
++      PyErr_SetFromErrno(PyExc_OSError);
++      return NULL;
++    }
++  }
+   resultobj = SWIG_From_int((int)(result));
+   {
+     if (resultobj) {
+@@ -12880,15 +14093,15 @@ extern "C" {
+           }
+         }
+         if (ci) {
+-          size_t shift = (ci->ptype) - types;
+-          swig_type_info *ty = types_initial[shift];
+-          size_t ldoc = (c - methods[i].ml_doc);
+-          size_t lptr = strlen(ty->name)+2*sizeof(void*)+2;
+-          char *ndoc = (char*)malloc(ldoc + lptr + 10);
+-          if (ndoc) {
+-            char *buff = ndoc;
+-            void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
+-            if (ptr) {
++          void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
++          if (ptr) {
++            size_t shift = (ci->ptype) - types;
++            swig_type_info *ty = types_initial[shift];
++            size_t ldoc = (c - methods[i].ml_doc);
++            size_t lptr = strlen(ty->name)+2*sizeof(void*)+2;
++            char *ndoc = (char*)malloc(ldoc + lptr + 10);
++            if (ndoc) {
++              char *buff = ndoc;
+               strncpy(buff, methods[i].ml_doc, ldoc);
+               buff += ldoc;
+               strncpy(buff, "swig_ptr: ", 10);
diff --git a/libsemanage.spec b/libsemanage.spec
index 3cb3a13..3094d54 100644
--- a/libsemanage.spec
+++ b/libsemanage.spec
@@ -10,7 +10,7 @@
 Summary: SELinux binary policy manipulation library 
 Name: libsemanage
 Version: 2.0.46
-Release: 3%{?dist}
+Release: 4%{?dist}
 License: LGPLv2+
 Group: System Environment/Libraries
 Source: http://www.nsa.gov/selinux/archives/libsemanage-%{version}.tgz
@@ -18,10 +18,6 @@ Patch: libsemanage-rhat.patch
 URL: http://www.selinuxproject.org
 Source1: semanage.conf
 
-# Add support to src/Makefile to support building the python bindings multiple
-# times, against different Python runtimes:
-Patch1: libsemanage-2.0.46-support-multiple-python-builds.patch
-
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: libselinux-devel >= %{libselinuxver} swig ustr-devel
 BuildRequires: libsepol-devel >= %{libsepolver} 
@@ -90,7 +86,6 @@ SELinux management applications.
 %prep
 %setup -q
 %patch -p2 -b .rhat
-%patch1 -p1 -b .support-multiple-python-builds
 
 %build
 # To support building the Python wrapper against multiple Python runtimes
@@ -213,6 +208,9 @@ rm -rf ${RPM_BUILD_ROOT}
 
 
 %changelog
+* Fri Mar 11 2011 Dan Walsh <dwalsh at redhat.com> - 2.0.46-4
+- Add exception throwing to semanage python library on failures
+
 * Tue Feb 08 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.0.46-3
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
 


More information about the scm-commits mailing list