about summary refs log tree commit diff
path: root/nss
diff options
context:
space:
mode:
Diffstat (limited to 'nss')
-rw-r--r--nss/getXXbyYY.c7
-rw-r--r--nss/getXXbyYY_r.c8
-rw-r--r--nss/getXXent.c4
-rw-r--r--nss/getXXent_r.c6
4 files changed, 13 insertions, 12 deletions
diff --git a/nss/getXXbyYY.c b/nss/getXXbyYY.c
index 15cdcba3ff..7a52e9d3ba 100644
--- a/nss/getXXbyYY.c
+++ b/nss/getXXbyYY.c
@@ -114,12 +114,13 @@ FUNCTION_NAME (ADD_PARAMS)
     }
 
   while (buffer != NULL
-	 && INTERNAL (REENTRANT_NAME) (ADD_VARIABLES, &resbuf, buffer,
-				       buffer_size, &result H_ERRNO_VAR) != 0
+	 && (INTERNAL (REENTRANT_NAME) (ADD_VARIABLES, &resbuf, buffer,
+					buffer_size, &result H_ERRNO_VAR)
+	     == ERANGE)
 #ifdef NEED_H_ERRNO
 	 && h_errno_tmp == NETDB_INTERNAL
 #endif
-	 && errno == ERANGE)
+	 )
     {
       char *new_buf;
       buffer_size += BUFLEN;
diff --git a/nss/getXXbyYY_r.c b/nss/getXXbyYY_r.c
index 7b10304a32..8ad4754a3b 100644
--- a/nss/getXXbyYY_r.c
+++ b/nss/getXXbyYY_r.c
@@ -122,7 +122,7 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
     {
       *h_errnop = NETDB_INTERNAL;
       *result = NULL;
-      return -1;
+      return errno;
     }
 # define resbuf (*resbuf)
 # include "digits_dots.c"
@@ -137,7 +137,7 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
     {
       nscd_status = NSCD_NAME (ADD_VARIABLES, resbuf, buffer, buflen
 			       H_ERRNO_VAR);
-      if (nscd_status < 1)
+      if (nscd_status >= 0)
 	{
 	  *result = nscd_status == 0 ? resbuf : NULL;
 	  return nscd_status;
@@ -162,7 +162,7 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
 	    {
 	      *h_errnop = NETDB_INTERNAL;
 	      *result = NULL;
-	      return -1;
+	      return errno;
 	    }
 #endif /* need _res */
 #ifdef NEED__RES_HCONF
@@ -205,7 +205,7 @@ done:
 #ifdef POSTPROCESS
   POSTPROCESS;
 #endif
-  return status == NSS_STATUS_SUCCESS ? 0 : -1;
+  return status == NSS_STATUS_SUCCESS ? 0 : errno;
 }
 
 #define do_weak_alias(n1, n2) weak_alias (n1, (n2))
diff --git a/nss/getXXent.c b/nss/getXXent.c
index e40d41b51e..497c0dee22 100644
--- a/nss/getXXent.c
+++ b/nss/getXXent.c
@@ -85,11 +85,11 @@ GETFUNC_NAME (void)
 
   while (buffer != NULL
 	 && INTERNAL (REENTRANT_GETNAME) (&resbuf, buffer, buffer_size, &result
-					  H_ERRNO_VAR) != 0
+					  H_ERRNO_VAR) == ERANGE
 #ifdef NEED_H_ERRNO
 	 && h_errno == NETDB_INTERNAL
 #endif
-	 && errno == ERANGE)
+	 )
     {
       char *new_buf;
       buffer_size += BUFLEN;
diff --git a/nss/getXXent_r.c b/nss/getXXent_r.c
index 4e2902d2ca..42de65dea2 100644
--- a/nss/getXXent_r.c
+++ b/nss/getXXent_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -228,7 +228,7 @@ INTERNAL (REENTRANT_GETNAME) (LOOKUP_TYPE *resbuf, char *buffer, size_t buflen,
     {
       __set_h_errno (NETDB_INTERNAL);
       *result = NULL;
-      return -1;
+      return errno;
     }
 #endif /* need _res */
 
@@ -288,7 +288,7 @@ INTERNAL (REENTRANT_GETNAME) (LOOKUP_TYPE *resbuf, char *buffer, size_t buflen,
   __libc_lock_unlock (lock);
 
   *result = status == NSS_STATUS_SUCCESS ? resbuf : NULL;
-  return status == NSS_STATUS_SUCCESS ? 0 : -1;
+  return status == NSS_STATUS_SUCCESS ? 0 : errno;
 }
 #define do_weak_alias(n1, n2) weak_alias (n1, n2)
 do_weak_alias (INTERNAL (REENTRANT_GETNAME), REENTRANT_GETNAME)