Skip to content

Commit

Permalink
ctypes triggers selinux execmem denial
Browse files Browse the repository at this point in the history
  • Loading branch information
benoitc committed Mar 6, 2011
1 parent 50bcc22 commit c21578d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion gunicorn/util.py
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)


Expand Down

0 comments on commit c21578d

Please sign in to comment.