summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2004-10-05 15:43:27 +0000
committerJakub Jelinek <jakub@redhat.com>2004-10-05 15:43:27 +0000
commitc25d26bbb4e1d6447b5a6b60afb2d6086796c9bc (patch)
tree8a23c84995a88f0437213d280e8335708cf7b09e
parentddbf09971df057003d35943a9d7d9d3653a26763 (diff)
downloadglibc-c25d26bbb4e1d6447b5a6b60afb2d6086796c9bc.tar.gz
glibc-c25d26bbb4e1d6447b5a6b60afb2d6086796c9bc.tar.xz
glibc-c25d26bbb4e1d6447b5a6b60afb2d6086796c9bc.zip
-rw-r--r--ChangeLog6
-rw-r--r--grp/initgroups.c8
-rw-r--r--nptl/ChangeLog7
-rw-r--r--nptl/sysdeps/pthread/timer_create.c8
-rw-r--r--nscd/initgrcache.c4
5 files changed, 23 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index ea4be8811c..60c8257c4a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-10-05  Ulrich Drepper  <drepper@redhat.com>
+
+	* grp/initgroups.c: Remove duplicate group IDs.
+	* grp/compat-initgroups.c: Likewise.
+	* nscd/initgrcache.c: Likewise.
+
 2004-10-05  Jakub Jelinek  <jakub@redhat.com>
 
 	* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h: Include dl-sysdep.h.
diff --git a/grp/initgroups.c b/grp/initgroups.c
index 5a3edecf09..d052cf48f7 100644
--- a/grp/initgroups.c
+++ b/grp/initgroups.c
@@ -112,9 +112,9 @@ internal_getgrouplist (const char *user, gid_t group, long int *size,
 	      break;
 
 	  if (inner < prev_start)
-	    ++cnt;
-	  else
 	    (*groupsp)[cnt] = (*groupsp)[--start];
+	  else
+	    ++cnt;
 	}
 
       /* This is really only for debugging.  */
@@ -141,10 +141,10 @@ int
 getgrouplist (const char *user, gid_t group, gid_t *groups, int *ngroups)
 {
   gid_t *newgroups;
-  long int size = *ngroups;
+  long int size = MAX (1, *ngroups);
   int result;
 
-  newgroups = (gid_t *) malloc (size * sizeof (gid_t));
+  newgroups = (gid_t *) malloc ((size + 1) * sizeof (gid_t));
   if (__builtin_expect (newgroups == NULL, 0))
     /* No more memory.  */
     // XXX This is wrong.  The user provided memory, we have to use
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index d52bd5ccc2..908d39383e 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,10 @@
+2004-10-05  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/pthread/timer_create.c (timer_create): Use
+	defined _POSIX_CPUTIME && _POSIX_CPUTIME >= 0 instead of
+	defined CLOCK_PROCESS_CPUTIME_ID #ifs and similarly for
+	THREAD_CPUTIME.
+
 2004-10-04  Ulrich Drepper  <drepper@redhat.com>
 
 	* sysdeps/unix/sysv/linux/i386/bits/posix_opt.h: Define _POSIX_CPUTIME
diff --git a/nptl/sysdeps/pthread/timer_create.c b/nptl/sysdeps/pthread/timer_create.c
index 57dd39e81b..2f5a587e8d 100644
--- a/nptl/sysdeps/pthread/timer_create.c
+++ b/nptl/sysdeps/pthread/timer_create.c
@@ -38,10 +38,10 @@ timer_create (clock_id, evp, timerid)
   struct thread_node *thread = NULL;
 
   if (0
-#ifdef CLOCK_PROCESS_CPUTIME_ID
+#if defined _POSIX_CPUTIME && _POSIX_CPUTIME >= 0
       || clock_id == CLOCK_PROCESS_CPUTIME_ID
 #endif
-#ifdef CLOCK_THREAD_CPUTIME_ID
+#if defined _POSIX_THREAD_CPUTIME && _POSIX_THREAD_CPUTIME >= 0
       || clock_id == CLOCK_THREAD_CPUTIME_ID
 #endif
       )
@@ -100,12 +100,12 @@ timer_create (clock_id, evp, timerid)
 	default:
 	  thread = &__timer_signal_thread_rclk;
 	  break;
-#ifdef CLOCK_PROCESS_CPUTIME_ID
+#if defined _POSIX_CPUTIME && _POSIX_CPUTIME >= 0
 	case CLOCK_PROCESS_CPUTIME_ID:
 	  thread = &__timer_signal_thread_pclk;
 	  break;
 #endif
-#ifdef CLOCK_THREAD_CPUTIME_ID
+#if defined _POSIX_THREAD_CPUTIME && _POSIX_THREAD_CPUTIME >= 0
 	case CLOCK_THREAD_CPUTIME_ID:
 	  thread = &__timer_signal_thread_tclk;
 	  break;
diff --git a/nscd/initgrcache.c b/nscd/initgrcache.c
index 762167ea19..b46433716b 100644
--- a/nscd/initgrcache.c
+++ b/nscd/initgrcache.c
@@ -144,9 +144,9 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
 	      break;
 
 	  if (inner < prev_start)
-	    ++cnt;
-	  else
 	    groups[cnt] = groups[--start];
+	  else
+	    ++cnt;
 	}
 
       if (status != NSS_STATUS_TRYAGAIN)