MCPcopy
hub / github.com/celery/celery / setgroups

Function setgroups

celery/platforms.py:485–499  ·  view source on GitHub ↗

Set active groups from a list of group ids.

(groups)

Source from the content-addressed store, hash-verified

483
484
485def setgroups(groups):
486 """Set active groups from a list of group ids."""
487 max_groups = None
488 try:
489 max_groups = os.sysconf('SC_NGROUPS_MAX')
490 except Exception: # pylint: disable=broad-except
491 pass
492 try:
493 return _setgroups_hack(groups[:max_groups])
494 except OSError as exc:
495 if exc.errno != errno.EPERM:
496 raise
497 if any(group not in groups for group in os.getgroups()):
498 # we shouldn't be allowed to change to this group.
499 raise
500
501
502def initgroups(uid, gid):

Callers 5

test_setgroupsMethod · 0.90
initgroupsFunction · 0.85

Calls 1

_setgroups_hackFunction · 0.85

Tested by 4

test_setgroupsMethod · 0.72