diff --git a/.gitignore b/.gitignore index 9a2c9f9..7046240 100644 --- a/.gitignore +++ b/.gitignore @@ -120,3 +120,4 @@ libsemanage-2.0.44.tgz libsemanage-2.0.45.tgz /libsemanage-2.0.46.tgz /libsemanage-2.1.0.tgz +/libsemanage-2.1.2.tgz diff --git a/libsemanage-2.0.46-support-multiple-python-builds.patch b/libsemanage-2.0.46-support-multiple-python-builds.patch deleted file mode 100644 index a65629f..0000000 --- a/libsemanage-2.0.46-support-multiple-python-builds.patch +++ /dev/null @@ -1,83 +0,0 @@ -diff -up libsemanage-2.0.46/src/Makefile.support-multiple-python-builds libsemanage-2.0.46/src/Makefile ---- libsemanage-2.0.46/src/Makefile.support-multiple-python-builds 2010-12-21 16:30:25.000000000 -0500 -+++ libsemanage-2.0.46/src/Makefile 2010-12-30 10:29:56.436647017 -0500 -@@ -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) -@@ -34,9 +62,9 @@ SWIGIF= semanageswig_python.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 -+SWIGSO=$(PYPREFIX)_semanage$(PY_DSO_SUFFIX) - SWIGFILES=$(SWIGSO) semanage.py - SWIGRUBYSO=_rubysemanage.so - LIBSO=$(TARGET).$(LIBVERSION) -@@ -63,13 +91,13 @@ pywrap: all $(SWIGLOBJ) $(SWIGSO) - rubywrap: all $(SWIGRUBYSO) - - $(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,$@ -@@ -132,7 +160,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-rhat.patch b/libsemanage-rhat.patch index 00432d7..46562fe 100644 --- a/libsemanage-rhat.patch +++ b/libsemanage-rhat.patch @@ -1,210 +1,21 @@ -diff --git a/libsemanage/include/semanage/handle.h b/libsemanage/include/semanage/handle.h -index a482cdd..e303713 100644 ---- a/libsemanage/include/semanage/handle.h -+++ b/libsemanage/include/semanage/handle.h -@@ -126,6 +126,9 @@ int semanage_is_connected(semanage_handle_t * sh); - /* returns 1 if policy is MLS, 0 otherwise. */ - int semanage_mls_enabled(semanage_handle_t *sh); - -+/* Change to alternate selinux root path */ -+int semanage_set_root(const char *path); -+ - /* META NOTES - * - * For all functions a non-negative number indicates success. For some -diff --git a/libsemanage/man/man3/semanage_set_root.3 b/libsemanage/man/man3/semanage_set_root.3 -new file mode 100644 -index 0000000..c464d66 ---- /dev/null -+++ b/libsemanage/man/man3/semanage_set_root.3 -@@ -0,0 +1,22 @@ -+.TH semanage_set_root 3 "1 June 2011" "dwalsh@redhat.com" "Libsemanage API documentation" -+ -+.SH "NAME" -+semanage_set_root \- SELinux Management API -+ -+.SH "SYNOPSIS" -+Set the alternate root directory for SELinux configuration directory. -+ -+.B #include -+ -+.B extern const char *semanage_set_root(const char *path); -+ -+.SH "DESCRIPTION" -+.TP -+This function sets an alternate root directory to for SELinux configuration paths to be used by the semanage library. -+ -+.SH "RETURN VALUE" -+In case of failure, -1 is returned. -+Otherwise 0 is returned. -+ -+.SH "SEE ALSO" -+.BR semanage_handle_create "(3), " semanage_connect "(3), " diff --git a/libsemanage/src/Makefile b/libsemanage/src/Makefile -index 7acf63d..a18f84e 100644 +index d21e972..f73b6ae 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) +@@ -69,6 +69,9 @@ pywrap: all $(SWIGSO) rubywrap: all $(SWIGRUBYSO) +semanageswig_python_exception.i: ../include/semanage/semanage.h -+ bash exception.sh > $@ ++ 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 + $(CC) $(filter-out -Werror, $(CFLAGS)) $(PYINC) -fPIC -DSHARED -c -o $@ $< - $(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/conf-parse.y b/libsemanage/src/conf-parse.y -index 9b261b9..77c00b2 100644 ---- a/libsemanage/src/conf-parse.y -+++ b/libsemanage/src/conf-parse.y -@@ -21,6 +21,7 @@ - %{ - - #include "semanage_conf.h" -+#include "handle.h" - - #include - #include -@@ -260,7 +261,7 @@ external_opt: PROG_PATH '=' ARG { PASSIGN(new_external->path, $3); } - static int semanage_conf_init(semanage_conf_t * conf) - { - conf->store_type = SEMANAGE_CON_DIRECT; -- conf->store_path = strdup(basename(selinux_policy_root())); -+ conf->store_path = strdup(basename(semanage_policy_root())); - conf->policyvers = sepol_policy_kern_vers_max(); - conf->expand_check = 1; - conf->handle_unknown = -1; -@@ -390,7 +391,7 @@ static int parse_module_store(char *arg) - if (strcmp(arg, "direct") == 0) { - current_conf->store_type = SEMANAGE_CON_DIRECT; - current_conf->store_path = -- strdup(basename(selinux_policy_root())); -+ strdup(basename(semanage_policy_root())); - current_conf->server_port = -1; - free(arg); - } else if (*arg == '/') { diff --git a/libsemanage/src/direct_api.c b/libsemanage/src/direct_api.c -index bceb6a7..dbdcdae 100644 +index aac1974..3dfa279 100644 --- a/libsemanage/src/direct_api.c +++ b/libsemanage/src/direct_api.c -@@ -2,7 +2,7 @@ - * Christopher Ashworth - * - * Copyright (C) 2004-2006 Tresys Technology, LLC -- * Copyright (C) 2005 Red Hat, Inc. -+ * Copyright (C) 2005-2011 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public -@@ -95,7 +95,7 @@ int semanage_direct_is_managed(semanage_handle_t * sh) - { - char polpath[PATH_MAX]; - -- snprintf(polpath, PATH_MAX, "%s%s", selinux_path(), -+ snprintf(polpath, PATH_MAX, "%s%s", semanage_selinux_path(), - sh->conf->store_path); - - if (semanage_check_init(polpath)) -@@ -118,7 +118,7 @@ int semanage_direct_connect(semanage_handle_t * sh) - char polpath[PATH_MAX]; - const char *path; - -- snprintf(polpath, PATH_MAX, "%s%s", selinux_path(), -+ snprintf(polpath, PATH_MAX, "%s%s", semanage_selinux_path(), - sh->conf->store_path); - - if (semanage_check_init(polpath)) @@ -353,17 +353,11 @@ static int parse_module_headers(semanage_handle_t * sh, char *module_data, semanage_path(SEMANAGE_TMP, SEMANAGE_MODULES)) == NULL) { return -1; @@ -298,266 +109,30 @@ index bceb6a7..dbdcdae 100644 if (unlink(module_filenames[i]) == -1) { ERR(sh, "Could not remove module file %s.", module_filenames[i]); -@@ -1539,7 +1503,7 @@ int semanage_direct_access_check(semanage_handle_t * sh) - { - char polpath[PATH_MAX]; - -- snprintf(polpath, PATH_MAX, "%s%s", selinux_path(), -+ snprintf(polpath, PATH_MAX, "%s%s", semanage_selinux_path(), - sh->conf->store_path); - - if (semanage_check_init(polpath)) -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 +index 847d87e..2870fa8 100644 --- a/libsemanage/src/genhomedircon.c +++ b/libsemanage/src/genhomedircon.c -@@ -310,6 +310,10 @@ static semanage_list_t *get_home_dirs(genhomedircon_settings_t * s) +@@ -314,6 +314,8 @@ static semanage_list_t *get_home_dirs(genhomedircon_settings_t * s) } if (strcmp(pwbuf->pw_dir, "/") == 0) continue; -+ if (strcmp(pwbuf->pw_dir, "/root") == 0) { ++ if (strcmp(pwbuf->pw_dir, "/root") == 0) + continue; -+ } -+ if (semanage_str_count(pwbuf->pw_dir, '/') <= 1) continue; if (!(path = strdup(pwbuf->pw_dir))) { -@@ -803,6 +807,9 @@ static genhomedircon_user_entry_t *get_users(genhomedircon_settings_t * s, +@@ -829,6 +831,8 @@ static genhomedircon_user_entry_t *get_users(genhomedircon_settings_t * s, * /root */ continue; } -+ if (strcmp(pwent->pw_dir, "/root") == 0) { ++ if (strcmp(pwent->pw_dir, "/root") == 0) + continue; -+ } if (push_user_entry(&head, name, seuname, - prefix, pwent->pw_dir) != STATUS_SUCCESS) { + prefix, pwent->pw_dir, level) != STATUS_SUCCESS) { *errors = STATUS_ERR; -diff --git a/libsemanage/src/handle.c b/libsemanage/src/handle.c -index 76caefd..1eb08b9 100644 ---- a/libsemanage/src/handle.c -+++ b/libsemanage/src/handle.c -@@ -38,6 +38,139 @@ - - #define SEMANAGE_COMMIT_READ_WAIT 5 - -+#include -+#include -+static char *private_selinux_path = NULL; -+static char *private_file_context_path = NULL; -+static char *private_file_context_local_path = NULL; -+static char *private_file_context_homedir_path = NULL; -+static char *private_homedir_context_path = NULL; -+static char *private_binary_policy_path = NULL; -+static char *private_usersconf_path = NULL; -+static char *private_netfilter_context_path = NULL; -+static char *private_policy_root = NULL; -+ -+void semanage_free_root() { -+ free(private_selinux_path); private_selinux_path = NULL; -+ free(private_file_context_path); private_file_context_path = NULL; -+ free(private_file_context_local_path); private_file_context_local_path = NULL; -+ free(private_file_context_homedir_path); private_file_context_homedir_path = NULL; -+ free(private_homedir_context_path); private_homedir_context_path = NULL; -+ free(private_binary_policy_path); private_binary_policy_path = NULL; -+ free(private_usersconf_path); private_usersconf_path = NULL; -+ free(private_netfilter_context_path); private_netfilter_context_path = NULL; -+ free(private_policy_root); private_policy_root = NULL; -+} -+ -+int semanage_set_root(const char *path) { -+ semanage_free_root(); -+ if ( asprintf(&private_selinux_path, "%s/%s", path, selinux_path()) < 0 ) { -+ goto error; -+ } -+ -+ if ( asprintf(&private_file_context_path, "%s/%s", path, selinux_file_context_path()) < 0 ) { -+ goto error; -+ } -+ -+ if ( asprintf(&private_file_context_local_path, "%s/%s", path, selinux_file_context_local_path()) < 0 ) { -+ goto error; -+ } -+ -+ if ( asprintf(&private_homedir_context_path, "%s/%s", path, selinux_homedir_context_path()) < 0 ) { -+ goto error; -+ } -+ -+ if ( asprintf(&private_file_context_homedir_path, "%s/%s", path, selinux_file_context_homedir_path()) < 0 ) { -+ goto error; -+ } -+ -+ if ( asprintf(&private_binary_policy_path, "%s/%s", path, selinux_binary_policy_path()) < 0 ) { -+ goto error; -+ } -+ -+ if ( asprintf(&private_usersconf_path, "%s/%s", path, selinux_usersconf_path()) < 0 ) { -+ goto error; -+ } -+ -+ if ( asprintf(&private_netfilter_context_path, "%s/%s", path, selinux_netfilter_context_path()) < 0 ) { -+ goto error; -+ } -+ -+ if ( asprintf(&private_policy_root, "%s/%s", path, selinux_policy_root()) < 0 ) { -+ goto error; -+ } -+ -+ return 0; -+error: -+ semanage_free_root(); -+ return -1; -+} -+hidden_def(semanage_set_root) -+ -+const char *semanage_file_context_path() { -+// printf("private_file_context_path %s\n", private_file_context_path); -+ if (private_file_context_path) -+ return private_file_context_path; -+ return selinux_file_context_path(); -+} -+ -+const char *semanage_file_context_local_path() { -+// printf("private_file_context_local_path %s\n", private_file_context_local_path); -+ if (private_file_context_local_path) -+ return private_file_context_local_path; -+ return selinux_file_context_local_path(); -+} -+ -+const char *semanage_file_context_homedir_path() { -+// printf("private_file_context_homedir_path %s\n", private_file_context_homedir_path); -+ if (private_file_context_homedir_path) -+ return private_file_context_homedir_path; -+ -+ return selinux_file_context_homedir_path(); -+} -+ -+const char *semanage_homedir_context_path() { -+// printf("private_homedir_context_path %s\n", private_homedir_context_path); -+ if (private_homedir_context_path) -+ return private_homedir_context_path; -+ return selinux_homedir_context_path(); -+} -+ -+const char *semanage_binary_policy_path() { -+// printf("private_binary_policy_path %s\n", private_binary_policy_path); -+ if (private_binary_policy_path) -+ return private_binary_policy_path; -+ return selinux_binary_policy_path(); -+} -+ -+const char *semanage_usersconf_path() { -+// printf("private_usersconf_path %s\n", private_usersconf_path); -+ if (private_usersconf_path) -+ return private_usersconf_path; -+ return selinux_usersconf_path(); -+} -+ -+const char *semanage_netfilter_context_path() { -+// printf("private_netfilter_context_path %s\n", private_netfilter_context_path); -+ if (private_netfilter_context_path) -+ return private_netfilter_context_path; -+ return selinux_netfilter_context_path(); -+} -+ -+const char *semanage_policy_root() { -+// printf("private_policy_root %s\n", private_policy_root); -+ if (private_policy_root) -+ return private_policy_root; -+ return selinux_policy_root(); -+} -+ -+const char *semanage_selinux_path(void) { -+// printf("private_selinux_path %s\n", private_selinux_path); -+ if (private_selinux_path) -+ return private_selinux_path; -+ return selinux_path(); -+} -+ - semanage_handle_t *semanage_handle_create(void) - { - semanage_handle_t *sh = NULL; -diff --git a/libsemanage/src/handle_internal.h b/libsemanage/src/handle_internal.h -index 8493a39..2971600 100644 ---- a/libsemanage/src/handle_internal.h -+++ b/libsemanage/src/handle_internal.h -@@ -5,7 +5,18 @@ - #include "dso.h" - - hidden_proto(semanage_begin_transaction) -- hidden_proto(semanage_handle_destroy) -- hidden_proto(semanage_reload_policy) -- hidden_proto(semanage_access_check) -+hidden_proto(semanage_handle_destroy) -+hidden_proto(semanage_reload_policy) -+hidden_proto(semanage_access_check) -+hidden_proto(semanage_set_root) -+ -+extern const char *semanage_selinux_path(void); -+extern const char *semanage_file_context_path(); -+extern const char *semanage_file_context_local_path(); -+extern const char *semanage_file_context_homedir_path(); -+extern const char *semanage_homedir_context_path(); -+extern const char *semanage_binary_policy_path(); -+extern const char *semanage_usersconf_path(); -+extern const char *semanage_netfilter_context_path(); -+extern const char *semanage_policy_root(); - #endif -diff --git a/libsemanage/src/libsemanage.map b/libsemanage/src/libsemanage.map -index 762e20e..3222e3d 100644 ---- a/libsemanage/src/libsemanage.map -+++ b/libsemanage/src/libsemanage.map -@@ -14,6 +14,7 @@ LIBSEMANAGE_1.0 { - semanage_module_get_version; semanage_select_store; - semanage_module_get_enabled; - semanage_reload_policy; semanage_set_reload; semanage_set_rebuild; -+ semanage_set_root; - semanage_user_*; semanage_bool_*; semanage_seuser_*; - semanage_iface_*; semanage_port_*; semanage_context_*; - semanage_node_*; -diff --git a/libsemanage/src/semanage.py b/libsemanage/src/semanage.py -index 3cffef7..da0ad71 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.3 - # - # Do not make changes to this file unless you know what you are doing--modify - # the SWIG interface file instead. -@@ -164,6 +164,10 @@ def semanage_mls_enabled(*args): - return _semanage.semanage_mls_enabled(*args) - semanage_mls_enabled = _semanage.semanage_mls_enabled - -+def semanage_set_root(*args): -+ return _semanage.semanage_set_root(*args) -+semanage_set_root = _semanage.semanage_set_root -+ - def semanage_module_install(*args): - return _semanage.semanage_module_install(*args) - semanage_module_install = _semanage.semanage_module_install diff --git a/libsemanage/src/semanage_store.c b/libsemanage/src/semanage_store.c -index 339bbd0..602a937 100644 +index 8d6ff1c..37b0c7a 100644 --- a/libsemanage/src/semanage_store.c +++ b/libsemanage/src/semanage_store.c @@ -57,7 +57,7 @@ typedef struct dbase_policydb dbase_t; @@ -569,30 +144,7 @@ index 339bbd0..602a937 100644 #define SEMANAGE_CONF_FILE "semanage.conf" /* relative path names to enum semanage_paths to special files and -@@ -90,7 +90,7 @@ static const char *semanage_store_paths[SEMANAGE_NUM_STORES] = { - "/tmp" - }; - --/* this is the module store path relative to selinux_policy_root() */ -+/* this is the module store path relative to semanage_policy_root() */ - #define SEMANAGE_MOD_DIR "/modules" - /* relative path names to enum sandbox_paths for special files within - * a sandbox */ -@@ -170,11 +170,11 @@ static int semanage_init_paths(const char *root) - semanage_relative_files[i]); - } - -- len = strlen(selinux_path()) + strlen(SEMANAGE_CONF_FILE); -+ len = strlen(semanage_selinux_path()) + strlen(SEMANAGE_CONF_FILE); - semanage_conf = calloc(len + 1, sizeof(char)); - if (!semanage_conf) - return -1; -- snprintf(semanage_conf, len, "%s%s", selinux_path(), -+ snprintf(semanage_conf, len, "%s%s", semanage_selinux_path(), - SEMANAGE_CONF_FILE); - - return 0; -@@ -425,6 +425,13 @@ int semanage_store_access_check(semanage_handle_t * sh) +@@ -425,6 +425,13 @@ int semanage_store_access_check(void) /********************* other I/O functions *********************/ @@ -681,7 +233,7 @@ index 339bbd0..602a937 100644 + + int i = 0, num_modules = *len; + char **names=*filenames; -+ ++ + while ( i < num_modules ) { + if (! semanage_module_enabled(names[i])) { + free(names[i]); @@ -696,55 +248,8 @@ index 339bbd0..602a937 100644 } /******************* routines that run external programs *******************/ -@@ -1071,14 +1125,14 @@ static int semanage_install_active(semanage_handle_t * sh) - const char *active_fc_hd = - semanage_path(SEMANAGE_ACTIVE, SEMANAGE_FC_HOMEDIRS); - -- const char *running_fc = selinux_file_context_path(); -- const char *running_fc_loc = selinux_file_context_local_path(); -- const char *running_fc_hd = selinux_file_context_homedir_path(); -- const char *running_hd = selinux_homedir_context_path(); -- const char *running_policy = selinux_binary_policy_path(); -- const char *running_seusers = selinux_usersconf_path(); -- const char *running_nc = selinux_netfilter_context_path(); -- const char *really_active_store = selinux_policy_root(); -+ const char *running_fc = semanage_file_context_path(); -+ const char *running_fc_loc = semanage_file_context_local_path(); -+ const char *running_fc_hd = semanage_file_context_homedir_path(); -+ const char *running_hd = semanage_homedir_context_path(); -+ const char *running_policy = semanage_binary_policy_path(); -+ const char *running_seusers = semanage_usersconf_path(); -+ const char *running_nc = semanage_netfilter_context_path(); -+ const char *really_active_store = semanage_policy_root(); - - /* This is very unelegant, the right thing to do is export the path - * building code in libselinux so that you can get paths for a given -@@ -1099,11 +1153,11 @@ static int semanage_install_active(semanage_handle_t * sh) - running_seusers += len; - running_nc += len; - -- len = strlen(selinux_path()) + strlen(sh->conf->store_path) + 1; -+ len = strlen(semanage_selinux_path()) + strlen(sh->conf->store_path) + 1; - storepath = (char *)malloc(len); - if (!storepath) - goto cleanup; -- snprintf(storepath, PATH_MAX, "%s%s", selinux_path(), -+ snprintf(storepath, PATH_MAX, "%s%s", semanage_selinux_path(), - sh->conf->store_path); - - snprintf(store_pol, PATH_MAX, "%s%s.%d", storepath, -@@ -1633,8 +1687,7 @@ int semanage_link_sandbox(semanage_handle_t * sh, - goto cleanup; - } - for (i = 0; i < num_modules; i++) { -- if (semanage_load_module(sh, module_filenames[i], mods + i) == -- -1) { -+ if (semanage_load_module(sh, module_filenames[i], mods + i) == -1) { - goto cleanup; - } - } diff --git a/libsemanage/src/semanage_store.h b/libsemanage/src/semanage_store.h -index 6abb2ee..8470191 100644 +index a0b2dd8..e980cdc 100644 --- a/libsemanage/src/semanage_store.h +++ b/libsemanage/src/semanage_store.h @@ -85,6 +85,8 @@ int semanage_get_modules_names(semanage_handle_t * sh, @@ -763,3181 +268,3 @@ index 6abb2ee..8470191 100644 -extern const char *DISABLESTR; - #endif -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..bf8bd84 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.3 - * - * 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 0x020003 - #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,10 +3798,47 @@ 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: -+ return NULL; -+} -+ -+ -+SWIGINTERN PyObject *_wrap_semanage_set_root(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { -+ PyObject *resultobj = 0; -+ char *arg1 = (char *) 0 ; -+ int res1 ; -+ char *buf1 = 0 ; -+ int alloc1 = 0 ; -+ PyObject * obj0 = 0 ; -+ int result; -+ -+ if (!PyArg_ParseTuple(args,(char *)"O:semanage_set_root",&obj0)) SWIG_fail; -+ res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); -+ if (!SWIG_IsOK(res1)) { -+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "semanage_set_root" "', argument " "1"" of type '" "char const *""'"); -+ } -+ arg1 = (char *)(buf1); -+ { -+ result = (int)semanage_set_root((char const *)arg1); -+ if (result < 0) { -+ PyErr_SetFromErrno(PyExc_OSError); -+ return NULL; -+ } -+ } - resultobj = SWIG_From_int((int)(result)); -+ if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return resultobj; - fail: -+ if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return NULL; - } - -@@ -3742,7 +3876,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 +3916,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 +3965,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 +4005,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 +4054,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 +4094,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 +4134,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 +4174,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 +4214,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 +4253,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 +4386,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 +4455,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 +4526,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 +4597,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 +4668,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 +4703,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 +4748,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 +4815,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 +4862,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 +4909,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 +4956,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 +5017,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 +5054,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 +5123,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 +5153,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 +5216,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 +5261,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 +5327,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 +5371,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 +5409,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 +5458,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 +5495,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 +5555,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 +5592,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 +5634,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 +5678,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 +5716,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 +5765,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 +5802,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 +5862,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 +5904,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 +5948,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 +5986,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 +6035,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 +6072,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 +6123,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 +6160,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 +6203,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,7 +6250,13 @@ 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); -+ { -+ 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 +6343,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 +6413,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 +6481,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 +6514,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 +6559,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 +6629,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 +6666,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 +6708,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 +6752,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 +6790,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 +6839,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 +6876,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 +6932,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 +6976,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 +7014,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 +7063,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 +7100,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 +7157,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 +7204,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 +7265,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 +7302,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 +7371,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 +7442,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 +7513,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 +7584,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 +7614,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 +7661,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 +7734,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 +7782,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 +7847,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 +7884,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 +7929,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 +7999,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 +8036,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 +8078,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 +8122,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 +8160,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 +8209,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 +8246,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 +8302,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 +8346,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 +8384,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 +8433,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 +8470,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 +8521,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 +8558,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 +8618,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 +8663,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 +8715,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 +8795,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 +8823,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 +8960,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 +8993,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 +9038,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 +9108,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 +9145,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 +9187,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 +9231,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 +9269,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 +9318,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 +9355,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 +9411,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,7 +9455,13 @@ 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); -+ { -+ 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))); -@@ -8687,7 +9493,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 +9542,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 +9579,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 +9630,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 +9667,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 +9719,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 +9766,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 +9859,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 +9889,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 +10009,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 +10042,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 +10087,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 +10157,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 +10194,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 +10236,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 +10280,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 +10318,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 +10367,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 +10404,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 +10460,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 +10504,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 +10542,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 +10591,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 +10628,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 +10685,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 +10732,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 +10793,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 +10830,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 +10899,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 +10970,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 +11041,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 +11076,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 +11121,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 +11191,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 +11228,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 +11270,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 +11314,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 +11352,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 +11401,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 +11438,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 +11494,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 +11538,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 +11576,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 +11625,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 +11662,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 +11713,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 +11750,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 +11812,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 +11861,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 +11927,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 +11977,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 +12043,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 +12101,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 +12145,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 +12195,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 +12261,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 +12319,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 +12349,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 +12469,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 +12502,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 +12547,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 +12617,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 +12654,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 +12696,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 +12740,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 +12778,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 +12827,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 +12864,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 +12920,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 +12964,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 +13002,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 +13051,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 +13088,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) { -@@ -11896,6 +13140,7 @@ static PyMethodDef SwigMethods[] = { - { (char *)"semanage_access_check", _wrap_semanage_access_check, METH_VARARGS, NULL}, - { (char *)"semanage_is_connected", _wrap_semanage_is_connected, METH_VARARGS, NULL}, - { (char *)"semanage_mls_enabled", _wrap_semanage_mls_enabled, METH_VARARGS, NULL}, -+ { (char *)"semanage_set_root", _wrap_semanage_set_root, METH_VARARGS, NULL}, - { (char *)"semanage_module_install", _wrap_semanage_module_install, METH_VARARGS, NULL}, - { (char *)"semanage_module_install_file", _wrap_semanage_module_install_file, METH_VARARGS, NULL}, - { (char *)"semanage_module_upgrade", _wrap_semanage_module_upgrade, METH_VARARGS, NULL}, -@@ -12880,15 +14125,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 281eb77..2d17a3a 100644 --- a/libsemanage.spec +++ b/libsemanage.spec @@ -4,13 +4,13 @@ %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(1))")} %endif -%define libsepolver 2.0.37-1 -%define libselinuxver 2.0.0-1 +%define libsepolver 2.1.0-1 +%define libselinuxver 2.1.0-1 Summary: SELinux binary policy manipulation library Name: libsemanage -Version: 2.1.0 -Release: 0%{?dist} +Version: 2.1.2 +Release: 1%{?dist} License: LGPLv2+ Group: System Environment/Libraries Source: libsemanage-%{version}.tgz @@ -206,8 +206,20 @@ rm -rf ${RPM_BUILD_ROOT} %{python3_sitearch}/__pycache__/semanage* %endif # if with_python3 - %changelog +* Thu Aug 18 2011 Dan Walsh - 2.1.2-1 +-Update to upstream +2.1.2 2011-08-17 + * print error debug info for buggy fc + * introduce semanage_set_root and friends + * throw exceptions in python rather than return + * python3 support. + * patch for MCS/MLS in user files + +2.1.1 2011-08-01 + * Remove generated files, expand .gitignore + * Use -Werror and change a few prototypes to support it + * Thu Jul 28 2011 Dan Walsh - 2.1.0-1 - Update to upstream * Release, minor version bump diff --git a/sources b/sources index c83d9a5..d0b2cc4 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -ee21c6204dce9520226b615016045386 libsemanage-2.1.0.tgz +b1c1e7514c42f0d1de2b8ac22f5fb3b7 libsemanage-2.1.2.tgz