ctypes triggers selinux execmem denial

https://bugzilla.redhat.com/show_bug.cgi?id=488396

fix issue #168. Thanks!
This commit is contained in:
benoitc 2011-03-06 10:14:52 +01:00
parent 50bcc22919
commit c21578df40

View File

@ -4,7 +4,13 @@
# See the NOTICE for more information.
import ctypes
try:
import ctypes
except MemoryError:
# selinux execmem denial
# https://bugzilla.redhat.com/show_bug.cgi?id=488396
ctypes = None
import fcntl
import os
import pkg_resources
@ -87,6 +93,8 @@ def set_owner_process(uid,gid):
try:
os.setgid(gid)
except OverflowError:
if not ctypes:
raise
# versions of python < 2.6.2 don't manage unsigned int for
# groups like on osx or fedora
os.setgid(-ctypes.c_int(-gid).value)
@ -98,6 +106,8 @@ def chown(path, uid, gid):
try:
os.chown(path, uid, gid)
except OverflowError:
if not ctypes:
raise
os.chown(path, uid, -ctypes.c_int(-gid).value)