diff options
| author | Diomidis Spinellis <dds@FreeBSD.org> | 2003-11-19 15:51:26 +0000 |
|---|---|---|
| committer | Diomidis Spinellis <dds@FreeBSD.org> | 2003-11-19 15:51:26 +0000 |
| commit | 434c74760ffe91c6f4cc3dff0d49a24dddb975c6 (patch) | |
| tree | 240c535a27403b15a86a4cfdd3f8384c585844ac | |
| parent | 6006b8f4c672a699a8d884d52b1797a59aac9307 (diff) | |
Notes
| -rw-r--r-- | lib/libc/gen/initgroups.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/libc/gen/initgroups.c b/lib/libc/gen/initgroups.c index 3a3f51356795..82bbb3af1fa6 100644 --- a/lib/libc/gen/initgroups.c +++ b/lib/libc/gen/initgroups.c @@ -50,9 +50,14 @@ initgroups(uname, agroup) const char *uname; gid_t agroup; { - int groups[NGROUPS], ngroups; + int ngroups; + /* + * Provide space for one group more than NGROUPS to allow + * setgroups to fail and set errno. + */ + gid_t groups[NGROUPS + 1]; - ngroups = NGROUPS; + ngroups = NGROUPS + 1; getgrouplist(uname, agroup, groups, &ngroups); return (setgroups(ngroups, groups)); } |
