posixmodule.c.ed   [plain text]


/^posix_getgroups/-1i
#include <pwd.h>
int getgrouplist_2(const char *name, gid_t basegid, gid_t **groups);

.
/gid_t grouplist\[MAX_GROUPS\];/c
        gid_t *grouplist = NULL;
        struct passwd *pw;
.
/n = getgroups(MAX_GROUPS, grouplist);/c
        if ((pw = getpwuid(getuid())) == NULL) {
            errno = EINVAL;
            posix_error();
            return NULL;
        }
        n = getgrouplist_2(pw->pw_name, pw->pw_gid, &grouplist);
.
/if (n < 0)/c
        if (n < 0) {
            errno = EINVAL;
.
/else {/s//} else {/
/return result;/i
    if (grouplist) free(grouplist);
.
/^posix_setgroups/a
.
/gid_t grouplist\[MAX_GROUPS\];/s//gid_t *grouplist;/
/if (len > MAX_GROUPS) {/a
.
.,/^[ 	]*}/c
	if ((grouplist = (gid_t *)malloc(len * sizeof(gid_t))) == NULL) {
		PyErr_NoMemory();
		return NULL;
	}
.
/Py_INCREF(Py_None);/i
	free(grouplist);
.
/^static struct constdef posix_constants_confstr/a
.
/^};/i
#ifdef _CS_DARWIN_USER_DIR
    {"CS_DARWIN_USER_DIR", _CS_DARWIN_USER_DIR},
#endif
#ifdef _CS_DARWIN_USER_TEMP_DIR
    {"CS_DARWIN_USER_TEMP_DIR", _CS_DARWIN_USER_TEMP_DIR},
#endif
#ifdef _CS_DARWIN_USER_CACHE_DIR
    {"CS_DARWIN_USER_CACHE_DIR", _CS_DARWIN_USER_CACHE_DIR},
#endif
.
w