versions of python < 2.6.2 don't manage unsigned int for groups like on osx or fedora

s Please enter the commit message for your changes. Lines starting
This commit is contained in:
benoitc 2010-02-21 11:06:43 +01:00
parent 316e943609
commit 40514ca2eb

View File

@ -3,7 +3,7 @@
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import ctypes
import grp
import logging
import optparse as op
@ -106,7 +106,13 @@ def set_owner_process(user,group):
gid = int(group)
else:
gid = grp.getgrnam(group).gr_gid
try:
os.setgid(gid)
except OverflowError:
# 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)
if user:
if user.isdigit() or isinstance(user, int):
uid = int(user)