repo.or.cz
/
musl.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
fix VIDIOC_DQEVENT (v4l2) ioctl fallback for pre-5.6 kernels
[musl.git]
/
src
/
misc
/
initgroups.c
blob
922a958142b0ad7b1f331f30725ecec29b91a309
1
#define _GNU_SOURCE
2
#include <grp.h>
3
#include <limits.h>
4
5
int
initgroups
(
const char
*
user
,
gid_t gid
)
6
{
7
gid_t groups
[
NGROUPS_MAX
];
8
int
count
=
NGROUPS_MAX
;
9
if
(
getgrouplist
(
user
,
gid
,
groups
, &
count
) <
0
)
return
-
1
;
10
return
setgroups
(
count
,
groups
);
11
}