about summary refs log tree commit diff
path: root/grp
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-04-28 21:56:46 +0000
committerUlrich Drepper <drepper@redhat.com>1999-04-28 21:56:46 +0000
commit390500b147a8063ea4be7313ec38cada26f9235a (patch)
treeedf14c04a0a46992ce4c04eeaf604fab99a9d960 /grp
parentfbb9cc9129ae3efdb1652b175f57956033102876 (diff)
downloadglibc-390500b147a8063ea4be7313ec38cada26f9235a.tar.gz
glibc-390500b147a8063ea4be7313ec38cada26f9235a.tar.xz
glibc-390500b147a8063ea4be7313ec38cada26f9235a.zip
Update.
1999-04-28  Ulrich Drepper  <drepper@cygnus.com>

	* manager.c (pthread_allocate_stack): Optimize initialization of new
	thread descriptor.
Diffstat (limited to 'grp')
-rw-r--r--grp/initgroups.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/grp/initgroups.c b/grp/initgroups.c
index 93f78eb547..0296625122 100644
--- a/grp/initgroups.c
+++ b/grp/initgroups.c
@@ -52,7 +52,7 @@ static enum nss_status
 compat_call (service_user *nip, const char *user, gid_t group, long int *start,
 	     long int *size, gid_t *groups, long int limit, int *errnop)
 {
-  struct group grpbuf, *g;
+  struct group grpbuf;
   size_t buflen = __sysconf (_SC_GETPW_R_SIZE_MAX);
   char *tmpbuf;
   enum nss_status status;
@@ -90,25 +90,24 @@ compat_call (service_user *nip, const char *user, gid_t group, long int *start,
       if (status != NSS_STATUS_SUCCESS)
         goto done;
 
-      g = &grpbuf;
-      if (g->gr_gid != group)
+      if (grpbuf.gr_gid != group)
         {
           char **m;
 
-          for (m = g->gr_mem; *m != NULL; ++m)
+          for (m = grpbuf.gr_mem; *m != NULL; ++m)
             if (strcmp (*m, user) == 0)
               {
                 /* Matches user.  Insert this group.  */
                 if (*start == *size && limit <= 0)
                   {
                     /* Need a bigger buffer.  */
-                    groups = realloc (groups, *size * sizeof (*groups));
+                    groups = realloc (groups, 2 * *size * sizeof (*groups));
                     if (groups == NULL)
                       goto done;
                     *size *= 2;
                   }
 
-                groups[*start] = g->gr_gid;
+                groups[*start] = grpbuf.gr_gid;
                 *start += 1;
 
                 if (*start == limit)
@@ -196,7 +195,7 @@ initgroups (user, group)
 
       /* This is really only for debugging.  */
       if (NSS_STATUS_TRYAGAIN > status || status > NSS_STATUS_RETURN)
-	 __libc_fatal ("illegal status in " __FUNCTION__);
+	__libc_fatal ("illegal status in " __FUNCTION__);
 
       if (status != NSS_STATUS_SUCCESS
 	  && nss_next_action (nip, status) == NSS_ACTION_RETURN)