about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-08-02 00:08:03 +0000
committerUlrich Drepper <drepper@redhat.com>2006-08-02 00:08:03 +0000
commitfbbc73b3d7fc1c1f4aa8c7f8d30ced6778c50506 (patch)
tree6e07dcee0e801aae4937016b279d4f997cc60dbd
parenta4518922f3f43dded5669f40b12227ab76df80fe (diff)
downloadglibc-fbbc73b3d7fc1c1f4aa8c7f8d30ced6778c50506.tar.gz
glibc-fbbc73b3d7fc1c1f4aa8c7f8d30ced6778c50506.tar.xz
glibc-fbbc73b3d7fc1c1f4aa8c7f8d30ced6778c50506.zip
* nscd/initgrcache.c (addinitgroupsX): Judge successful lookups by
	status of NSS calls, not the number of returned entries.
-rw-r--r--ChangeLog3
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/smp.h14
-rw-r--r--nscd/initgrcache.c5
3 files changed, 14 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index fa9aea7cd2..a4bb3e8c34 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2006-08-01  Ulrich Drepper  <drepper@redhat.com>
 
+	* nscd/initgrcache.c (addinitgroupsX): Judge successful lookups by
+	status of NSS calls, not the number of returned entries.
+
 	* sysdeps/unix/sysv/linux/syscalls.list: Remove add_key,
 	request_key, keyctl.
 
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/smp.h b/nptl/sysdeps/unix/sysv/linux/i386/smp.h
index cb24c9e177..f68a0c0758 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/smp.h
+++ b/nptl/sysdeps/unix/sysv/linux/i386/smp.h
@@ -31,25 +31,25 @@ is_smp_system (void)
 {
   union
   {
-    struct utsname  uts;
+    struct utsname uts;
     char buf[512];
-  };
+  } u;
   char *cp;
 
   /* Try reading the number using `sysctl' first.  */
-  if (uname (&uts) == 0)
-    cp = uts.version;
+  if (uname (&u.uts) == 0)
+    cp = u.uts.version;
   else
     {
       /* This was not successful.  Now try reading the /proc filesystem.  */
       int fd = open_not_cancel_2 ("/proc/sys/kernel/version", O_RDONLY);
       if (__builtin_expect (fd, 0) == -1
-	  || (reslen = read_not_cancel (fd, buf, sizeof (buf))) <= 0)
+	  || read_not_cancel (fd, u.buf, sizeof (u.buf)) <= 0)
 	/* This also didn't work.  We give up and say it's a UP machine.  */
-	buf[0] = '\0';
+	u.buf[0] = '\0';
 
       close_not_cancel_no_status (fd);
-      cp = buf;
+      cp = u.buf;
     }
 
   return strstr (cp, "SMP") != NULL;
diff --git a/nscd/initgrcache.c b/nscd/initgrcache.c
index f2ff03a0b1..b4ae13903a 100644
--- a/nscd/initgrcache.c
+++ b/nscd/initgrcache.c
@@ -117,6 +117,7 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
     goto out;
 
   /* Nothing added yet.  */
+  bool any_success = false;
   while (! no_more)
     {
       long int prev_start = start;
@@ -158,6 +159,8 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
       if (NSS_STATUS_TRYAGAIN > status || status > NSS_STATUS_RETURN)
 	__libc_fatal ("illegal status in internal_getgrouplist");
 
+      any_success |= status == NSS_STATUS_SUCCESS;
+
       if (status != NSS_STATUS_SUCCESS
 	  && nss_next_action (nip, status) == NSS_ACTION_RETURN)
 	 break;
@@ -171,7 +174,7 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
   ssize_t total;
   ssize_t written;
  out:
-  if (start == 0)
+  if (!any_success)
     {
       /* Nothing found.  Create a negative result record.  */
       written = total = sizeof (notfound);