Created
February 6, 2012 22:28
-
-
Save clayg/1755433 to your computer and use it in GitHub Desktop.
how to get access to initgroups in python < 2.7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from ctypes import CDLL, get_errno, c_char_p, c_int | |
libc = CDLL(None, use_errno=True) | |
def errcheck(result, func, arguments): | |
if result != 0: | |
e = get_errno() | |
raise OSError(e, os.strerror(e)) | |
initgroups = libc.initgroups | |
initgroups.argtypes = [c_char_p, c_int] | |
initgroups.restype = c_int | |
initgroups.errcheck = errcheck |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment