about summary refs log tree commit diff
path: root/nis/nss_nis
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-08-26 07:06:57 +0000
committerUlrich Drepper <drepper@redhat.com>2002-08-26 07:06:57 +0000
commit34816665b678a06e096a378303b68d35ff10a693 (patch)
tree471e49cf229dc64a80a72764e1d2db2c9c6e2818 /nis/nss_nis
parent40e15c4da81e899cbb4c6299fd4f48e1b1391115 (diff)
downloadglibc-34816665b678a06e096a378303b68d35ff10a693.tar.gz
glibc-34816665b678a06e096a378303b68d35ff10a693.tar.xz
glibc-34816665b678a06e096a378303b68d35ff10a693.zip
Update.
	* nss/getXXbyYY_r.c (REENTRANT_NAME): Return ENOENT if status is
	neither SUCCESS nor TRYAGAIN [PR libc/4259].
	* nss/nss_files/files-XXX.c (internal_getent): Don't set *errnop
	to ENOENT if no entry is found.
	* nis/nss_compat/compat-grp.c: Don't set errno in case of lookup
	failure.
	* nis/nss_compat/compat-initgroups.c: Likewise.
	* nis/nss_compat/compat-pwd.c: Likewise.
	* nis/nss_compat/compat-spwd.c: Likewise.
	* nis/nss_nis/nis-alias.c: Likewise.
	* nis/nss_nis/nis-ethers.c: Likewise.
	* nis/nss_nis/nis-grp.c: Likewise.
	* nis/nss_nis/nis-hosts.c: Likewise.
	* nis/nss_nis/nis-initgroups.c: Likewise.
	* nis/nss_nis/nis-netgrp.c: Likewise.
	* nis/nss_nis/nis-network.c: Likewise.
	* nis/nss_nis/nis-proto.c: Likewise.
	* nis/nss_nis/nis-publickey.c: Likewise.
	* nis/nss_nis/nis-pwd.c: Likewise.
	* nis/nss_nis/nis-rpc.c: Likewise.
	* nis/nss_nis/nis-service.c: Likewise.
	* nis/nss_nis/nis-spwd.c: Likewise.
	* resolv/nss_dns/dns-host.c: Likewise.
	* resolv/nss_dns/dns-network.c: Likewise.
	* nis/nss_nisplus/nisplus-alias.c: Save errno around NIS calls.
	* nis/nss_nisplus/nisplus-ethers.c: Likewise.
	* nis/nss_nisplus/nisplus-grp.c: Likewise.
	* nis/nss_nisplus/nisplus-hosts.c: Likewise.
	* nis/nss_nisplus/nisplus-network.c: Likewise.
	* nis/nss_nisplus/nisplus-proto.c: Likewise.
	* nis/nss_nisplus/nisplus-pwd.c: Likewise.
	* nis/nss_nisplus/nisplus-rpc.c: Likewise.
	* nis/nss_nisplus/nisplus-service.c: Likewise.
	* nis/nss_nisplus/nisplus-spwd.c: Likewise.
	* hesiod/nss_hesiod/hesiod-pwd.c (lookup): Preserve errno value.
	* hesiod/nss_hesiod/hesiod-proto.c (lookup): Likewise.
	* hesiod/nss_hesiod/hesiod-grp.c (lookup): Likewise.
	* hesiod/nss_hesiod/hesiod-service.c (lookup): Likewise.
Diffstat (limited to 'nis/nss_nis')
-rw-r--r--nis/nss_nis/nis-alias.c11
-rw-r--r--nis/nss_nis/nis-ethers.c22
-rw-r--r--nis/nss_nis/nis-grp.c20
-rw-r--r--nis/nss_nis/nis-hosts.c10
-rw-r--r--nis/nss_nis/nis-initgroups.c8
-rw-r--r--nis/nss_nis/nis-netgrp.c7
-rw-r--r--nis/nss_nis/nis-network.c25
-rw-r--r--nis/nss_nis/nis-proto.c26
-rw-r--r--nis/nss_nis/nis-publickey.c19
-rw-r--r--nis/nss_nis/nis-pwd.c24
-rw-r--r--nis/nss_nis/nis-rpc.c22
-rw-r--r--nis/nss_nis/nis-service.c28
-rw-r--r--nis/nss_nis/nis-spwd.c15
13 files changed, 64 insertions, 173 deletions
diff --git a/nis/nss_nis/nis-alias.c b/nis/nss_nis/nis-alias.c
index 8b78126b21..2ceaa1da64 100644
--- a/nis/nss_nis/nis-alias.c
+++ b/nis/nss_nis/nis-alias.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 1999i, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1996,1997,1998,1999,2001,2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
 
@@ -167,9 +167,7 @@ internal_nis_getaliasent_r (struct aliasent *alias, char *buffer,
 				      &result, &len));
       if (retval != NSS_STATUS_SUCCESS)
 	{
-	  if (retval == NSS_STATUS_NOTFOUND)
-	    *errnop = ENOENT;
-	  else if (retval == NSS_STATUS_TRYAGAIN)
+	  if (retval == NSS_STATUS_TRYAGAIN)
             *errnop = errno;
           return retval;
         }
@@ -278,10 +276,7 @@ _nss_nis_getaliasbyname_r (const char *name, struct aliasent *alias,
       if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
       else
-	{
-	  *errnop = ENOENT;
-	  return NSS_STATUS_NOTFOUND;
-	}
+	return NSS_STATUS_NOTFOUND;
     }
 
   return NSS_STATUS_SUCCESS;
diff --git a/nis/nss_nis/nis-ethers.c b/nis/nss_nis/nis-ethers.c
index 8c446209ad..54f10a5d0d 100644
--- a/nis/nss_nis/nis-ethers.c
+++ b/nis/nss_nis/nis-ethers.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2000, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
 
@@ -159,10 +159,8 @@ internal_nis_getetherent_r (struct etherent *eth, char *buffer, size_t buflen,
       char *p;
 
       if (next == NULL)
-	{
-	  *errnop = ENOENT;
-	  return NSS_STATUS_NOTFOUND;
-	}
+	return NSS_STATUS_NOTFOUND;
+
       p = strncpy (buffer, next->val, buflen);
 
       while (isspace (*p))
@@ -216,9 +214,7 @@ _nss_nis_gethostton_r (const char *name, struct etherent *eth,
 
   if (retval != NSS_STATUS_SUCCESS)
     {
-      if (retval == NSS_STATUS_NOTFOUND)
-	*errnop = ENOENT;
-      else if (retval == NSS_STATUS_TRYAGAIN)
+      if (retval == NSS_STATUS_TRYAGAIN)
         *errnop = errno;
       return retval;
     }
@@ -242,10 +238,7 @@ _nss_nis_gethostton_r (const char *name, struct etherent *eth,
       if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
       else
-	{
-	  *errnop = ENOENT;
-	  return NSS_STATUS_NOTFOUND;
-	}
+	return NSS_STATUS_NOTFOUND;
     }
   return NSS_STATUS_SUCCESS;
 }
@@ -306,10 +299,7 @@ _nss_nis_getntohost_r (const struct ether_addr *addr, struct etherent *eth,
       if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
       else
-	{
-	  *errnop = ENOENT;
-	  return NSS_STATUS_NOTFOUND;
-	}
+	return NSS_STATUS_NOTFOUND;
     }
   return NSS_STATUS_SUCCESS;
 }
diff --git a/nis/nss_nis/nis-grp.c b/nis/nss_nis/nis-grp.c
index e85d68bdf7..68db76636b 100644
--- a/nis/nss_nis/nis-grp.c
+++ b/nis/nss_nis/nis-grp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1996,1997,1998,1999,2001,2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
 
@@ -104,9 +104,7 @@ internal_nis_getgrent_r (struct group *grp, char *buffer, size_t buflen,
 
       if (retval != NSS_STATUS_SUCCESS)
         {
-	  if (retval == NSS_STATUS_NOTFOUND)
-	    *errnop = ENOENT;
-          else if (retval == NSS_STATUS_TRYAGAIN)
+          if (retval == NSS_STATUS_TRYAGAIN)
             *errnop = errno;
           return retval;
         }
@@ -206,10 +204,7 @@ _nss_nis_getgrnam_r (const char *name, struct group *grp,
       if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
       else
-	{
-	  *errnop = ENOENT;
-	  return NSS_STATUS_NOTFOUND;
-	}
+	return NSS_STATUS_NOTFOUND;
     }
   return NSS_STATUS_SUCCESS;
 }
@@ -234,9 +229,7 @@ _nss_nis_getgrgid_r (gid_t gid, struct group *grp,
 
   if (retval != NSS_STATUS_SUCCESS)
     {
-      if (retval == NSS_STATUS_NOTFOUND)
-	*errnop = ENOENT;
-      else if (retval == NSS_STATUS_TRYAGAIN)
+      if (retval == NSS_STATUS_TRYAGAIN)
         *errnop = errno;
       return retval;
     }
@@ -260,10 +253,7 @@ _nss_nis_getgrgid_r (gid_t gid, struct group *grp,
       if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
       else
-	{
-	  *errnop = ENOENT;
-	  return NSS_STATUS_NOTFOUND;
-	}
+	return NSS_STATUS_NOTFOUND;
     }
   return NSS_STATUS_SUCCESS;
 }
diff --git a/nis/nss_nis/nis-hosts.c b/nis/nss_nis/nis-hosts.c
index c855a0a7a3..9b0332939c 100644
--- a/nis/nss_nis/nis-hosts.c
+++ b/nis/nss_nis/nis-hosts.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1996,1997,1998,1999,2000,2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
 
@@ -181,7 +181,6 @@ internal_nis_gethostent_r (struct hostent *host, char *buffer,
 	      *h_errnop = TRY_AGAIN;
 	      break;
 	    case NSS_STATUS_NOTFOUND:
-	      *errnop = ENOENT;
 	      *h_errnop = HOST_NOT_FOUND;
 	      break;
 	    default:
@@ -321,7 +320,6 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
       else
 	{
 	  *h_errnop = HOST_NOT_FOUND;
-	  *errnop = ENOENT;
 	  return NSS_STATUS_NOTFOUND;
 	}
     }
@@ -393,10 +391,8 @@ _nss_nis_gethostbyaddr_r (const void *addr, socklen_t addrlen, int af,
 	  *errnop = errno;
 	}
       if (retval == NSS_STATUS_NOTFOUND)
-	{
-	  *h_errnop = HOST_NOT_FOUND;
-	  *errnop = ENOENT;
-	}
+	*h_errnop = HOST_NOT_FOUND;
+
       return retval;
     }
 
diff --git a/nis/nss_nis/nis-initgroups.c b/nis/nss_nis/nis-initgroups.c
index bdeb3ad088..de7444e870 100644
--- a/nis/nss_nis/nis-initgroups.c
+++ b/nis/nss_nis/nis-initgroups.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
 
@@ -119,10 +119,8 @@ internal_getgrent_r (struct group *grp, char *buffer, size_t buflen,
   do
     {
       if (intern->next == NULL)
-	{
-	  *errnop = ENOENT;
-	  return NSS_STATUS_NOTFOUND;
-	}
+	return NSS_STATUS_NOTFOUND;
+
       p = strncpy (buffer, intern->next->val, buflen);
       while (isspace (*p))
         ++p;
diff --git a/nis/nss_nis/nis-netgrp.c b/nis/nss_nis/nis-netgrp.c
index f5a73e79bb..c9b52428c3 100644
--- a/nis/nss_nis/nis-netgrp.c
+++ b/nis/nss_nis/nis-netgrp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
 
@@ -116,10 +116,7 @@ _nss_nis_getnetgrent_r (struct __netgrent *result, char *buffer, size_t buflen,
   enum nss_status status;
 
   if (cursor == NULL)
-    {
-      *errnop = ENOENT;
-      return NSS_STATUS_NOTFOUND;
-    }
+    return NSS_STATUS_NOTFOUND;
 
   __libc_lock_lock (lock);
 
diff --git a/nis/nss_nis/nis-network.c b/nis/nss_nis/nis-network.c
index 25215a7674..0e40b6f26c 100644
--- a/nis/nss_nis/nis-network.c
+++ b/nis/nss_nis/nis-network.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2000, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
 
@@ -105,9 +105,7 @@ internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen,
 
       if (retval != NSS_STATUS_SUCCESS)
         {
-	  if (retval == NSS_STATUS_NOTFOUND)
-	    *errnop = ENOENT;
-          else if (retval == NSS_STATUS_TRYAGAIN)
+          if (retval == NSS_STATUS_TRYAGAIN)
 	    {
 	      *herrnop = NETDB_INTERNAL;
 	      *errnop = errno;
@@ -206,9 +204,7 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer,
 
   if (retval != NSS_STATUS_SUCCESS)
     {
-      if (retval == NSS_STATUS_NOTFOUND)
-	*errnop = ENOENT;
-      else if (retval == NSS_STATUS_TRYAGAIN)
+      if (retval == NSS_STATUS_TRYAGAIN)
 	{
 	  *errnop = errno;
 	  *herrnop = NETDB_INTERNAL;
@@ -238,10 +234,7 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer,
       if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
       else
-	{
-	  *errnop = ENOENT;
-	  return NSS_STATUS_NOTFOUND;
-	}
+	return NSS_STATUS_NOTFOUND;
     }
   else
     return NSS_STATUS_SUCCESS;
@@ -289,10 +282,7 @@ _nss_nis_getnetbyaddr_r (uint32_t addr, int type, struct netent *net,
 		    continue;
 		  }
 		else
-		  {
-		    *errnop = ENOENT;
-		    return NSS_STATUS_NOTFOUND;
-		  }
+		  return NSS_STATUS_NOTFOUND;
 	      }
 	    else
 	      {
@@ -324,10 +314,7 @@ _nss_nis_getnetbyaddr_r (uint32_t addr, int type, struct netent *net,
 	    if (parse_res == -1)
 	      return NSS_STATUS_TRYAGAIN;
 	    else
-	      {
-		*errnop = ENOENT;
-		return NSS_STATUS_NOTFOUND;
-	      }
+	      return NSS_STATUS_NOTFOUND;
 	  }
 	else
 	  return NSS_STATUS_SUCCESS;
diff --git a/nis/nss_nis/nis-proto.c b/nis/nss_nis/nis-proto.c
index 867c8da159..00e86dfa6b 100644
--- a/nis/nss_nis/nis-proto.c
+++ b/nis/nss_nis/nis-proto.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1996,1997,1998,2000,2001,2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
 
@@ -156,10 +156,8 @@ internal_nis_getprotoent_r (struct protoent *proto,
       char *p;
 
       if (next == NULL)
-	{
-	  *errnop = ENOENT;
-	  return NSS_STATUS_NOTFOUND;
-	}
+	return NSS_STATUS_NOTFOUND;
+
       p = strncpy (buffer, next->val, buflen);
 
       while (isspace (*p))
@@ -213,9 +211,7 @@ _nss_nis_getprotobyname_r (const char *name, struct protoent *proto,
 
   if (retval != NSS_STATUS_SUCCESS)
     {
-      if (retval == NSS_STATUS_NOTFOUND)
-	*errnop = ENOENT;
-      else if (retval == NSS_STATUS_TRYAGAIN)
+      if (retval == NSS_STATUS_TRYAGAIN)
 	*errnop = errno;
       return retval;
     }
@@ -239,10 +235,7 @@ _nss_nis_getprotobyname_r (const char *name, struct protoent *proto,
       if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
       else
-	{
-	  *errnop = ENOENT;
-	  return NSS_STATUS_NOTFOUND;
-	}
+	return NSS_STATUS_NOTFOUND;
     }
   return NSS_STATUS_SUCCESS;
 }
@@ -267,9 +260,7 @@ _nss_nis_getprotobynumber_r (int number, struct protoent *proto,
 
   if (retval != NSS_STATUS_SUCCESS)
     {
-      if (retval == NSS_STATUS_NOTFOUND)
-	*errnop = ENOENT;
-      else if (retval == NSS_STATUS_TRYAGAIN)
+      if (retval == NSS_STATUS_TRYAGAIN)
 	*errnop = errno;
       return retval;
     }
@@ -293,10 +284,7 @@ _nss_nis_getprotobynumber_r (int number, struct protoent *proto,
       if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
       else
-	{
-	  *errnop = ENOENT;
-	  return NSS_STATUS_NOTFOUND;
-	}
+	return NSS_STATUS_NOTFOUND;
     }
   return NSS_STATUS_SUCCESS;
 }
diff --git a/nis/nss_nis/nis-publickey.c b/nis/nss_nis/nis-publickey.c
index f686054426..6e92112d11 100644
--- a/nis/nss_nis/nis-publickey.c
+++ b/nis/nss_nis/nis-publickey.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1996,1997,1998,1999,2001,2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
 
@@ -61,9 +61,7 @@ _nss_nis_getpublickey (const char *netname, char *pkey, int *errnop)
 
   if (retval != NSS_STATUS_SUCCESS)
     {
-      if (retval == NSS_STATUS_NOTFOUND)
-	*errnop = ENOENT;
-      else if (retval == NSS_STATUS_TRYAGAIN)
+      if (retval == NSS_STATUS_TRYAGAIN)
 	*errnop = errno;
       return retval;
     }
@@ -109,9 +107,7 @@ _nss_nis_getsecretkey (const char *netname, char *skey, char *passwd,
 
   if (retval != NSS_STATUS_SUCCESS)
     {
-      if (retval == NSS_STATUS_NOTFOUND)
-	*errnop = ENOENT;
-      else if (retval == NSS_STATUS_TRYAGAIN)
+      if (retval == NSS_STATUS_TRYAGAIN)
 	*errnop = errno;
       return retval;
     }
@@ -180,7 +176,7 @@ parse_netid_str (const char *s, uid_t *uidp, gid_t *gidp, int *gidlenp,
   gidlen = 0;
 
   /* After strtoul() ep should point to the first invalid character.
-     This is the marker "," we search for the next value.  */ 
+     This is the marker "," we search for the next value.  */
   while (ep != NULL && *ep == ',')
     {
       ep++;
@@ -221,7 +217,6 @@ _nss_nis_netname2user (char netname[MAXNETNAMELEN + 1], uid_t *uidp,
       break;			/* the successful case */
     case YPERR_DOMAIN:
     case YPERR_KEY:
-      *errnop = ENOENT;
       return NSS_STATUS_NOTFOUND;
     case YPERR_MAP:
     default:
@@ -238,9 +233,7 @@ _nss_nis_netname2user (char netname[MAXNETNAMELEN + 1], uid_t *uidp,
       return err;
     }
   else
-    {
-      *errnop = ENOENT;
-      return NSS_STATUS_NOTFOUND;
-    }
+    return NSS_STATUS_NOTFOUND;
+
   return NSS_STATUS_SUCCESS;
 }
diff --git a/nis/nss_nis/nis-pwd.c b/nis/nss_nis/nis-pwd.c
index 4845fd1c75..da5ffabff1 100644
--- a/nis/nss_nis/nis-pwd.c
+++ b/nis/nss_nis/nis-pwd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
 
@@ -106,9 +106,7 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen,
 
       if (retval != NSS_STATUS_SUCCESS)
         {
-	  if (retval == NSS_STATUS_NOTFOUND)
-	    *errnop = ENOENT;
-          else if (retval == NSS_STATUS_TRYAGAIN)
+          if (retval == NSS_STATUS_TRYAGAIN)
             *errnop = errno;
           return retval;
         }
@@ -233,9 +231,7 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd,
 
   if (retval != NSS_STATUS_SUCCESS)
     {
-      if (retval == NSS_STATUS_NOTFOUND)
-	*errnop = ENOENT;
-      else if (retval == NSS_STATUS_TRYAGAIN)
+      if (retval == NSS_STATUS_TRYAGAIN)
 	*errnop = errno;
       return retval;
     }
@@ -306,10 +302,7 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd,
       if (parse_res == -1)
         return NSS_STATUS_TRYAGAIN;
       else
-	{
-	  *errnop = ENOENT;
-	  return NSS_STATUS_NOTFOUND;
-	}
+	return NSS_STATUS_NOTFOUND;
     }
   else
     return NSS_STATUS_SUCCESS;
@@ -336,9 +329,7 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd,
 
   if (retval != NSS_STATUS_SUCCESS)
     {
-      if (retval == NSS_STATUS_NOTFOUND)
-	*errnop = ENOENT;
-      else if (retval == NSS_STATUS_TRYAGAIN)
+      if (retval == NSS_STATUS_TRYAGAIN)
 	*errnop = errno;
       return retval;
     }
@@ -410,10 +401,7 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd,
       if (parse_res == -1)
         return NSS_STATUS_TRYAGAIN;
      else
-       {
-	 *errnop = ENOENT;
-	 return NSS_STATUS_NOTFOUND;
-       }
+       return NSS_STATUS_NOTFOUND;
     }
   else
     return NSS_STATUS_SUCCESS;
diff --git a/nis/nss_nis/nis-rpc.c b/nis/nss_nis/nis-rpc.c
index 8c1a3d4860..1f9e5b4600 100644
--- a/nis/nss_nis/nis-rpc.c
+++ b/nis/nss_nis/nis-rpc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 2000, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
 
@@ -173,10 +173,8 @@ internal_nis_getrpcent_r (struct rpcent *rpc, char *buffer, size_t buflen,
   do
     {
       if (data->next == NULL)
-	{
-	  *errnop = ENOENT;
-	  return NSS_STATUS_NOTFOUND;
-	}
+	return NSS_STATUS_NOTFOUND;
+
       p = strncpy (buffer, data->next->val, buflen);
       while (isspace (*p))
         ++p;
@@ -251,10 +249,7 @@ _nss_nis_getrpcbyname_r (const char *name, struct rpcent *rpc,
   internal_nis_endrpcent (&data);
 
   if (!found && status == NSS_STATUS_SUCCESS)
-    {
-      *errnop = ENOENT;
-      return NSS_STATUS_NOTFOUND;
-    }
+    return NSS_STATUS_NOTFOUND;
   else
     return status;
 }
@@ -279,9 +274,7 @@ _nss_nis_getrpcbynumber_r (int number, struct rpcent *rpc,
 
   if (retval != NSS_STATUS_SUCCESS)
     {
-      if (retval == NSS_STATUS_NOTFOUND)
-	*errnop = ENOENT;
-      else if (retval == NSS_STATUS_TRYAGAIN)
+      if (retval == NSS_STATUS_TRYAGAIN)
 	*errnop = errno;
       return retval;
     }
@@ -306,10 +299,7 @@ _nss_nis_getrpcbynumber_r (int number, struct rpcent *rpc,
       if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
       else
-	{
-	  *errnop = ENOENT;
-	  return NSS_STATUS_NOTFOUND;
-	}
+	return NSS_STATUS_NOTFOUND;
     }
   else
     return NSS_STATUS_SUCCESS;
diff --git a/nis/nss_nis/nis-service.c b/nis/nss_nis/nis-service.c
index bd2227afc3..6affdb5209 100644
--- a/nis/nss_nis/nis-service.c
+++ b/nis/nss_nis/nis-service.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
 
@@ -173,10 +173,8 @@ internal_nis_getservent_r (struct servent *serv, char *buffer,
   do
     {
       if (data->next == NULL)
-	{
-	  *errnop = ENOENT;
-	  return NSS_STATUS_NOTFOUND;
-	}
+	return NSS_STATUS_NOTFOUND;
+
       p = strncpy (buffer, data->next->val, buflen);
       while (isspace (*p))
         ++p;
@@ -270,10 +268,7 @@ _nss_nis_getservbyname_r (const char *name, const char *protocol,
 	      if (parse_res == -1)
 		return NSS_STATUS_TRYAGAIN;
 	      else
-		{
-		  *errnop = ENOENT;
-		  return NSS_STATUS_NOTFOUND;
-		}
+		return NSS_STATUS_NOTFOUND;
 	    }
 	  else
 	    return NSS_STATUS_SUCCESS;
@@ -305,10 +300,7 @@ _nss_nis_getservbyname_r (const char *name, const char *protocol,
   internal_nis_endservent (&data);
 
   if (!found && status == NSS_STATUS_SUCCESS)
-    {
-      *errnop = ENOENT;
-      return NSS_STATUS_NOTFOUND;
-    }
+    return NSS_STATUS_NOTFOUND;
   else
     return status;
 }
@@ -367,10 +359,7 @@ _nss_nis_getservbyport_r (int port, const char *protocol,
 	      if (parse_res == -1)
 		return NSS_STATUS_TRYAGAIN;
 	      else
-		{
-		  *errnop = ENOENT;
-		  return NSS_STATUS_NOTFOUND;
-		}
+		return NSS_STATUS_NOTFOUND;
 	    }
 	  else
 	    return NSS_STATUS_SUCCESS;
@@ -392,10 +381,7 @@ _nss_nis_getservbyport_r (int port, const char *protocol,
   internal_nis_endservent (&data);
 
   if (!found && status == NSS_STATUS_SUCCESS)
-    {
-      *errnop = ENOENT;
-      return NSS_STATUS_NOTFOUND;
-    }
+    return NSS_STATUS_NOTFOUND;
   else
     return status;
 }
diff --git a/nis/nss_nis/nis-spwd.c b/nis/nss_nis/nis-spwd.c
index 907ba395bf..c06e95457e 100644
--- a/nis/nss_nis/nis-spwd.c
+++ b/nis/nss_nis/nis-spwd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
 
@@ -104,9 +104,7 @@ internal_nis_getspent_r (struct spwd *sp, char *buffer, size_t buflen,
 
       if (retval != NSS_STATUS_SUCCESS)
         {
-          if (retval == NSS_STATUS_NOTFOUND)
-	    *errnop = ENOENT;
-	  else if (retval == NSS_STATUS_TRYAGAIN)
+	  if (retval == NSS_STATUS_TRYAGAIN)
 	    *errnop = errno;
           return retval;
         }
@@ -180,9 +178,7 @@ _nss_nis_getspnam_r (const char *name, struct spwd *sp,
 
   if (retval != NSS_STATUS_SUCCESS)
     {
-      if (retval == NSS_STATUS_NOTFOUND)
-	*errnop = ENOENT;
-      else if (retval == NSS_STATUS_TRYAGAIN)
+      if (retval == NSS_STATUS_TRYAGAIN)
 	*errnop = errno;
       return retval;
     }
@@ -206,10 +202,7 @@ _nss_nis_getspnam_r (const char *name, struct spwd *sp,
       if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
       else
-	{
-	  *errnop = ENOENT;
-	  return NSS_STATUS_NOTFOUND;
-	}
+	return NSS_STATUS_NOTFOUND;
     }
   return NSS_STATUS_SUCCESS;
 }