From 950cc3955910dd11f83890dcde6b9f1053ac52cf Mon Sep 17 00:00:00 2001 From: Stefan Farfeleder Date: Sat, 2 Oct 2004 11:40:48 +0000 Subject: [PATCH] Pass an array of gid_t rather than an array of int to getgroups(). PR: 56646 --- usr.bin/id/id.c | 3 ++- usr.sbin/jail/jail.c | 3 ++- usr.sbin/mountd/mountd.c | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/usr.bin/id/id.c b/usr.bin/id/id.c index f8fba74c86e1..085ef7c41b47 100644 --- a/usr.bin/id/id.c +++ b/usr.bin/id/id.c @@ -274,7 +274,8 @@ user(struct passwd *pw) { struct group *gr; const char *fmt; - int cnt, gid, lastgid, ngroups, groups[NGROUPS + 1]; + gid_t gid, lastgid, groups[NGROUPS + 1]; + int cnt, ngroups; (void)printf("uid=%u(%s)", pw->pw_uid, pw->pw_name); gid = pw->pw_gid; diff --git a/usr.sbin/jail/jail.c b/usr.sbin/jail/jail.c index 0f379a7f58b9..e467eb2426bf 100644 --- a/usr.sbin/jail/jail.c +++ b/usr.sbin/jail/jail.c @@ -53,7 +53,8 @@ main(int argc, char **argv) struct jail j; struct passwd *pwd; struct in_addr in; - int ch, groups[NGROUPS], i, iflag, lflag, ngroups, uflag, Uflag; + gid_t groups[NGROUPS]; + int ch, i, iflag, lflag, ngroups, uflag, Uflag; char path[PATH_MAX], *username; static char *cleanenv; const char *shell, *p; diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c index 242a30ecb071..f93746650d18 100644 --- a/usr.sbin/mountd/mountd.c +++ b/usr.sbin/mountd/mountd.c @@ -2144,7 +2144,8 @@ parsecred(namelist, cr) char *names; struct passwd *pw; struct group *gr; - int ngroups, groups[NGROUPS + 1]; + gid_t groups[NGROUPS + 1]; + int ngroups; cr->cr_version = XUCRED_VERSION; /* @@ -2175,7 +2176,7 @@ parsecred(namelist, cr) if (getgrouplist(pw->pw_name, pw->pw_gid, groups, &ngroups)) syslog(LOG_ERR, "too many groups"); /* - * Convert from int's to gid_t's and compress out duplicate + * Compress out duplicate. */ cr->cr_ngroups = ngroups - 1; cr->cr_groups[0] = groups[0];