aboutsummaryrefslogtreecommitdiff
path: root/devel/libmsocket/files/patch-file.c
diff options
context:
space:
mode:
Diffstat (limited to 'devel/libmsocket/files/patch-file.c')
-rw-r--r--devel/libmsocket/files/patch-file.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/devel/libmsocket/files/patch-file.c b/devel/libmsocket/files/patch-file.c
new file mode 100644
index 000000000000..298dd90d06ce
--- /dev/null
+++ b/devel/libmsocket/files/patch-file.c
@@ -0,0 +1,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);