From 35504a6f2d420cb5c80dff987d7e76d5fd0f109b Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 4 Sep 2003 04:43:56 +0000 Subject: Update. 2003-09-03 Ulrich Drepper * nss/getXXbyYY_r.c (INTERNAL): Explicitly set errno and avoid returning ERANGE if this wasn't intended. --- nss/getXXbyYY_r.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'nss') 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; } -- cgit v1.2.3