about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-09-04 04:43:56 +0000
committerUlrich Drepper <drepper@redhat.com>2003-09-04 04:43:56 +0000
commit35504a6f2d420cb5c80dff987d7e76d5fd0f109b (patch)
tree0bce0c3637f1eee9a124640795290b2b3341ac29
parent9c42bc3b9ed33179fadc2f37bb4274ddb84bf503 (diff)
downloadglibc-35504a6f2d420cb5c80dff987d7e76d5fd0f109b.tar.gz
glibc-35504a6f2d420cb5c80dff987d7e76d5fd0f109b.tar.xz
glibc-35504a6f2d420cb5c80dff987d7e76d5fd0f109b.zip
Update.
2003-09-03  Ulrich Drepper  <drepper@redhat.com>

	* nss/getXXbyYY_r.c (INTERNAL): Explicitly set errno and avoid
	returning ERANGE if this wasn't intended.
-rw-r--r--ChangeLog5
-rw-r--r--nss/getXXbyYY_r.c21
2 files changed, 21 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index d757d863be..4b7c0cd1e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-09-03  Ulrich Drepper  <drepper@redhat.com>
+
+	* nss/getXXbyYY_r.c (INTERNAL): Explicitly set errno and avoid
+	returning ERANGE if this wasn't intended.
+
 2003-09-03  Jakub Jelinek  <jakub@redhat.com>
 
 	* intl/loadmsgcat.c (open, close, read, mmap, munmap): Define as
diff --git a/nss/getXXbyYY_r.c b/nss/getXXbyYY_r.c
index aca6a94a35..a0e0e003b7 100644
--- a/nss/getXXbyYY_r.c
+++ b/nss/getXXbyYY_r.c
@@ -247,13 +247,24 @@ done:
 #ifdef POSTPROCESS
   POSTPROCESS;
 #endif
-  return (status == NSS_STATUS_SUCCESS ? 0
+
+  int result;
+  if (status == NSS_STATUS_SUCCESS)
+    result = 0;
+  /* Don't pass back ERANGE if this is not for a too-small buffer.  */
+  else if (errno == ERANGE && status != NSS_STATUS_TRYAGAIN)
+    {
 #ifdef NEED_H_ERRNO
-	  /* These functions only set errno if h_errno is NETDB_INTERNAL.  */
-	  : status == NSS_STATUS_TRYAGAIN && *h_errnop != NETDB_INTERNAL
-	  ? EAGAIN
+      /* These functions only set errno if h_errno is NETDB_INTERNAL.  */
+      if (*h_errnop != NETDB_INTERNAL)
 #endif
-	  : errno);
+	result = ENOENT;
+    }
+  else
+    return errno;
+
+  __set_errno (result);
+  return result;
 }