rpms/coreutils/devel coreutils-getgrouplist.patch,1.6,1.7

Kamil Dudka kdudka at fedoraproject.org
Fri May 14 12:36:48 UTC 2010


Author: kdudka

Update of /cvs/extras/rpms/coreutils/devel
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv27483

Modified Files:
	coreutils-getgrouplist.patch 
Log Message:
restore a part of coreutils-getgrouplist.patch which has been lost during rediff

coreutils-getgrouplist.patch:
 lib/getugroups.c |    4 ++++
 lib/mgetgroups.c |   37 ++++++++++++++++++++++++++++++-------
 m4/jm-macros.m4  |    1 +
 3 files changed, 35 insertions(+), 7 deletions(-)

Index: coreutils-getgrouplist.patch
===================================================================
RCS file: /cvs/extras/rpms/coreutils/devel/coreutils-getgrouplist.patch,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -p -r1.6 -r1.7
--- coreutils-getgrouplist.patch	27 Nov 2009 13:24:09 -0000	1.6
+++ coreutils-getgrouplist.patch	14 May 2010 12:36:48 -0000	1.7
@@ -1,6 +1,7 @@
-diff -urp coreutils-6.10-orig/lib/getugroups.c coreutils-6.10/lib/getugroups.c
---- coreutils-6.10-orig/lib/getugroups.c	2007-10-17 15:47:25.000000000 +0200
-+++ coreutils-6.10/lib/getugroups.c	2008-01-24 16:37:04.000000000 +0100
+diff --git a/lib/getugroups.c b/lib/getugroups.c
+index 299bae6..8ece29b 100644
+--- a/lib/getugroups.c
++++ b/lib/getugroups.c
 @@ -19,6 +19,9 @@
  
  #include <config.h>
@@ -11,15 +12,71 @@ diff -urp coreutils-6.10-orig/lib/getugr
  #include "getugroups.h"
  
  #include <errno.h>
-@@ -123,3 +126,4 @@ getugroups (int maxcount, GETGROUPS_T *g
+@@ -123,3 +126,4 @@ getugroups (int maxcount, gid_t *grouplist, char const *username,
  }
  
  #endif /* HAVE_GRP_H */
 +#endif	/* have getgrouplist */
-diff -urp coreutils-6.10-orig/m4/jm-macros.m4 coreutils-6.10/m4/jm-macros.m4
---- coreutils-6.10-orig/m4/jm-macros.m4	2007-11-25 14:23:31.000000000 +0100
-+++ coreutils-6.10/m4/jm-macros.m4	2008-01-24 16:42:00.000000000 +0100
-@@ -52,6 +52,7 @@ AC_DEFUN([coreutils_MACROS],
+diff --git a/lib/mgetgroups.c b/lib/mgetgroups.c
+index 76474c2..0a9d221 100644
+--- a/lib/mgetgroups.c
++++ b/lib/mgetgroups.c
+@@ -115,9 +115,17 @@ mgetgroups (char const *username, gid_t gid, gid_t **groups)
+   /* else no username, so fall through and use getgroups. */
+ #endif
+ 
+-  max_n_groups = (username
+-                  ? getugroups (0, NULL, username, gid)
+-                  : getgroups (0, NULL));
++  if (!username)
++    max_n_groups = getgroups(0, NULL);
++  else 
++  {
++#ifdef HAVE_GETGROUPLIST
++    max_n_groups = 0;
++    getgrouplist (username, gid, NULL, &max_n_groups);
++#else
++    max_n_groups = getugroups (0, NULL, username, gid);
++#endif
++  }
+ 
+   /* If we failed to count groups because there is no supplemental
+      group support, then return an array containing just GID.
+@@ -139,10 +147,25 @@ mgetgroups (char const *username, gid_t gid, gid_t **groups)
+   if (g == NULL)
+     return -1;
+ 
+-  ng = (username
+-        ? getugroups (max_n_groups, g, username, gid)
+-        : getgroups (max_n_groups - (gid != (gid_t) -1),
+-                                g + (gid != (gid_t) -1)));
++  if (!username)
++    ng = getgroups (max_n_groups, g);
++  else
++  {
++#ifdef HAVE_GETGROUPLIST
++    int e;
++    ng = max_n_groups;
++    while ((e = getgrouplist (username, gid, g, &ng)) == -1
++	&& ng > max_n_groups)
++    {
++      max_n_groups = ng;
++      g = xrealloc (g, max_n_groups * sizeof (GETGROUPS_T));
++    }
++    if (e == -1)
++      ng = -1;
++#else
++    ng = getugroups (max_n_groups, g, username, gid);
++#endif
++  }
+ 
+   if (ng < 0)
+     {
+diff --git a/m4/jm-macros.m4 b/m4/jm-macros.m4
+index 62777c7..5180243 100644
+--- a/m4/jm-macros.m4
++++ b/m4/jm-macros.m4
+@@ -78,6 +78,7 @@ AC_DEFUN([coreutils_MACROS],
      fchown \
      fchmod \
      ftruncate \



More information about the scm-commits mailing list