summaryrefslogtreecommitdiffstats
path: root/pym/portage/_selinux.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-08-14 06:02:56 +0000
committerZac Medico <zmedico@gentoo.org>2009-08-14 06:02:56 +0000
commitf08a6765a443ed104889a3a15a4f42c3a0eece3b (patch)
tree74ae3c68503fadb4fe64364cc7fc4ce9cb9259e0 /pym/portage/_selinux.py
parentbdb5e16a137ee9f228d7028a2ea7f97b8f7acb09 (diff)
downloadportage-f08a6765a443ed104889a3a15a4f42c3a0eece3b.tar.gz
portage-f08a6765a443ed104889a3a15a4f42c3a0eece3b.tar.bz2
portage-f08a6765a443ed104889a3a15a4f42c3a0eece3b.zip
Replace the selinux.spawn() function with a spawn_wrapper() function and
use it inside portage._spawn_fetch() and portage.spawn(). svn path=/main/trunk/; revision=14022
Diffstat (limited to 'pym/portage/_selinux.py')
-rw-r--r--pym/portage/_selinux.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/pym/portage/_selinux.py b/pym/portage/_selinux.py
index e3c35ec5d..e91eb110c 100644
--- a/pym/portage/_selinux.py
+++ b/pym/portage/_selinux.py
@@ -73,14 +73,18 @@ def setfscreate(ctx="\n"):
raise OSError(
"setfscreate: Failed setting fs create context \"%s\"." % ctx)
-def spawn(selinux_type, spawn_func, mycommand, opt_name=None, **keywords):
- selinux_type = portage._unicode_encode(selinux_type)
- con = settype(selinux_type)
- setexec(con)
- try:
- return spawn_func(mycommand, opt_name=opt_name, **keywords)
- finally:
- setexec()
+def spawn_wrapper(spawn_func, selinux_type):
+
+ def wrapper_func(*args, **kwargs):
+ selinux_type = portage._unicode_encode(selinux_type)
+ con = settype(selinux_type)
+ setexec(con)
+ try:
+ return spawn_func(*args, **kwargs)
+ finally:
+ setexec()
+
+ return wrapper_func
def symlink(target, link, reflnk):
target = portage._unicode_encode(target)