summaryrefslogtreecommitdiff
path: root/src/daemontools-extras
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-07-16 15:57:36 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-07-16 15:57:36 +0000
commit29ce94f03614d66428223cc2cd7b474948b8f8ab (patch)
tree4bbb2e0d899f575a830b376baea3673358ede432 /src/daemontools-extras
parentc84b8ade3f2d1349a6e4b68b1bd497b0909cfcda (diff)
downloads6-29ce94f03614d66428223cc2cd7b474948b8f8ab.tar.xz
Fix setgroups() invocation on SnowflakeBSD
Diffstat (limited to 'src/daemontools-extras')
-rw-r--r--src/daemontools-extras/s6-applyuidgid.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/daemontools-extras/s6-applyuidgid.c b/src/daemontools-extras/s6-applyuidgid.c
index a770b2a..9264f52 100644
--- a/src/daemontools-extras/s6-applyuidgid.c
+++ b/src/daemontools-extras/s6-applyuidgid.c
@@ -1,6 +1,5 @@
/* ISC license. */
-#include <skalibs/nonposix.h>
#include <unistd.h>
#include <grp.h>
#include <limits.h>
@@ -18,7 +17,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
{
uid_t uid = 0 ;
gid_t gid = 0 ;
- gid_t gids[NGROUPS_MAX] ;
+ gid_t gids[NGROUPS_MAX+1] ;
size_t gidn = (size_t)-1 ;
int unexport = 0 ;
PROG = "s6-applyuidgid" ;
@@ -44,7 +43,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
if (!gid0_scan(x, &gid)) strerr_dieinvalid(100, "GID") ;
x = env_get2(envp, "GIDLIST") ;
if (!x) strerr_dienotset(100, "GIDLIST") ;
- if (!gid_scanlist(gids, NGROUPS_MAX, x, &gidn) && *x)
+ if (!gid_scanlist(gids, NGROUPS_MAX+1, x, &gidn) && *x)
strerr_dieinvalid(100, "GIDLIST") ;
break ;
}
@@ -55,7 +54,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
}
if (!argc) dieusage() ;
- if (gidn != (size_t)-1 && setgroups(gidn, gids) < 0)
+ if (gidn != (size_t)-1 && skalibs_setgroups(gidn, gids) < 0)
strerr_diefu1sys(111, "set supplementary group list") ;
if (gid && setgid(gid) < 0)
strerr_diefu1sys(111, "setgid") ;