blob: 298dd90d06cecf29eb4aa2beb98b7cecbe241634 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
$FreeBSD$
--- file.c.orig
+++ file.c
@@ -171,6 +171,7 @@
gid_t l;
register unsigned int i;
int grpcnt;
+ long ngroups_max;
if (!fs)
{
@@ -212,13 +213,14 @@
return(1);
}
- glist = (gid_t *)malloc(NGROUPS + 1);
+ ngroups_max = sysconf(_SC_NGROUPS_MAX) + 1;
+ glist = (gid_t *)malloc(sizeof(gid_t) * ngroups_max);
if (!glist)
{
return(-1);
}
- if ((grpcnt = getgroups((NGROUPS + 1), glist)) < 0)
+ if ((grpcnt = getgroups(ngroups_max, glist)) < 0)
{
free(glist);
return(-1);
@@ -257,6 +259,7 @@
gid_t l;
register unsigned int i;
int grpcnt;
+ long ngroups_max;
if (!fs)
{
@@ -298,13 +301,14 @@
return(1);
}
- glist = (gid_t *)malloc(NGROUPS + 1);
+ ngroups_max = sysconf(_SC_NGROUPS_MAX) + 1;
+ glist = (gid_t *)malloc(sizeof(gid_t) * ngroups_max);
if (!glist)
{
return(-1);
}
- if ((grpcnt = getgroups((NGROUPS + 1), glist)) < 0)
+ if ((grpcnt = getgroups(ngroups_max, glist)) < 0)
{
free(glist);
return(-1);
|