Skip to content

Commit

Permalink
Merge pull request python-diamond#650 from bhepple/patch-1
Browse files Browse the repository at this point in the history
Support python26 - os.initgroups()
  • Loading branch information
shortdudey123 authored May 16, 2017
2 parents 71e683c + ad3862d commit f2bece4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion bin/diamond
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,14 @@ def main():
try:
if gid != -1 and uid != -1:
# Manually set the groups since they aren't set by default
os.initgroups(pwd.getpwuid(uid).pw_name, gid)

# Python 2.7+
if hasattr(os, 'initgroups'):
os.initgroups(user, gid)
# Python 2.6
else:
os.setgroups([e.gr_gid for e in grp.getgrall()
if user in e.gr_mem] + [gid])

if gid != -1 and os.getgid() != gid:
# Set GID
Expand Down

0 comments on commit f2bece4

Please sign in to comment.