initial check-in, version 0.5.0

This commit is contained in:
Rich Felker 2011-02-12 00:22:29 -05:00
commit 0b44a0315b
1021 changed files with 45711 additions and 0 deletions

15
src/linux/initgroups.c Normal file
View file

@ -0,0 +1,15 @@
#include <sys/types.h>
#include <unistd.h>
#include <grp.h>
#include <limits.h>
int getgrouplist(const char *, gid_t, gid_t *, int *);
int setgroups(size_t, const gid_t *);
int initgroups(const char *user, gid_t gid)
{
gid_t groups[NGROUPS_MAX];
int count;
if (getgrouplist(user, gid, groups, &count) < 0) return -1;
return setgroups(count, groups);
}