about summary refs log tree commit diff
path: root/nis/nss_compat
diff options
context:
space:
mode:
Diffstat (limited to 'nis/nss_compat')
-rw-r--r--nis/nss_compat/compat-initgroups.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/nis/nss_compat/compat-initgroups.c b/nis/nss_compat/compat-initgroups.c
index fd16475ea9..76ca95d1e6 100644
--- a/nis/nss_compat/compat-initgroups.c
+++ b/nis/nss_compat/compat-initgroups.c
@@ -303,10 +303,19 @@ getgrent_next_nss (ent_t *ent, char *buffer, size_t buflen, const char *user,
 		else
 		  tmpbuf = extend_alloca (tmpbuf, tmplen, 2 * tmplen);
 
-	      if (!in_blacklist (grpbuf.gr_name,
-				 strlen (grpbuf.gr_name), ent))
-		check_and_add_group (user, group, start, size, groupsp,
-				     limit, &grpbuf);
+	      if (__builtin_expect  (status != NSS_STATUS_NOTFOUND, 1))
+		{
+		  if (__builtin_expect  (status != NSS_STATUS_SUCCESS, 0))
+		    {
+		      free (mygroups);
+		      return status;
+		    }
+
+		  if (!in_blacklist (grpbuf.gr_name,
+				     strlen (grpbuf.gr_name), ent))
+		    check_and_add_group (user, group, start, size, groupsp,
+					 limit, &grpbuf);
+		}
 	    }
 
 	  free (mygroups);