initial check-in, version 0.5.0
This commit is contained in:
commit
0b44a0315b
1021 changed files with 45711 additions and 0 deletions
15
src/linux/initgroups.c
Normal file
15
src/linux/initgroups.c
Normal 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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue