mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
ctypes triggers selinux execmem denial
https://bugzilla.redhat.com/show_bug.cgi?id=488396 fix issue #168. Thanks!
This commit is contained in:
parent
50bcc22919
commit
c21578df40
@ -4,7 +4,13 @@
|
|||||||
# See the NOTICE for more information.
|
# 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 fcntl
|
||||||
import os
|
import os
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
@ -87,6 +93,8 @@ def set_owner_process(uid,gid):
|
|||||||
try:
|
try:
|
||||||
os.setgid(gid)
|
os.setgid(gid)
|
||||||
except OverflowError:
|
except OverflowError:
|
||||||
|
if not ctypes:
|
||||||
|
raise
|
||||||
# versions of python < 2.6.2 don't manage unsigned int for
|
# versions of python < 2.6.2 don't manage unsigned int for
|
||||||
# groups like on osx or fedora
|
# groups like on osx or fedora
|
||||||
os.setgid(-ctypes.c_int(-gid).value)
|
os.setgid(-ctypes.c_int(-gid).value)
|
||||||
@ -98,6 +106,8 @@ def chown(path, uid, gid):
|
|||||||
try:
|
try:
|
||||||
os.chown(path, uid, gid)
|
os.chown(path, uid, gid)
|
||||||
except OverflowError:
|
except OverflowError:
|
||||||
|
if not ctypes:
|
||||||
|
raise
|
||||||
os.chown(path, uid, -ctypes.c_int(-gid).value)
|
os.chown(path, uid, -ctypes.c_int(-gid).value)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user