summaryrefslogtreecommitdiff
path: root/src/libstddjb/prot_grps.c
blob: cc4ba0d413af165d577251c42d09de7b9df9918c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* ISC license. */

/* MT-unsafe */

#include <skalibs/nonposix.h>
#include <unistd.h>
#include <grp.h>
#include <limits.h>
#include <skalibs/setgroups.h>
#include <skalibs/djbunix.h>

int prot_grps (char const *name)
{
  gid_t tab[NGROUPS_MAX] ;
  int n = prot_readgroups(name, tab, NGROUPS_MAX) ;
  return n < 0 ? -1 : setgroups(n, tab) ;
}