This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] nss: Use h_errno directly in getXXbyYY
- From: fweimer at redhat dot com (Florian Weimer)
- To: libc-alpha at sourceware dot org
- Date: Wed, 09 Aug 2017 17:27:18 +0200
- Subject: [PATCH] nss: Use h_errno directly in getXXbyYY
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=fweimer at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7499FE8A13
2017-08-09 Florian Weimer <fweimer@redhat.com>
* nss/getXXbyYY.c (FUNCTION_NAME): Use h_errno variable directly.
(H_ERRNO_VAR, H_ERRNO_VAR_P): Adjust.
diff --git a/nss/getXXbyYY.c b/nss/getXXbyYY.c
index a439b81..26ee726 100644
--- a/nss/getXXbyYY.c
+++ b/nss/getXXbyYY.c
@@ -62,8 +62,8 @@
/* Sometimes we need to store error codes in the `h_errno' variable. */
#ifdef NEED_H_ERRNO
# define H_ERRNO_PARM , int *h_errnop
-# define H_ERRNO_VAR , &h_errno_tmp
-# define H_ERRNO_VAR_P &h_errno_tmp
+# define H_ERRNO_VAR , &h_errno
+# define H_ERRNO_VAR_P &h_errno
#else
# define H_ERRNO_PARM
# define H_ERRNO_VAR
@@ -94,9 +94,6 @@ FUNCTION_NAME (ADD_PARAMS)
static size_t buffer_size;
static LOOKUP_TYPE resbuf;
LOOKUP_TYPE *result;
-#ifdef NEED_H_ERRNO
- int h_errno_tmp = 0;
-#endif
#ifdef HANDLE_DIGITS_DOTS
/* Wrap both __nss_hostname_digits_dots and the actual lookup
@@ -135,7 +132,7 @@ FUNCTION_NAME (ADD_PARAMS)
buffer_size, &result H_ERRNO_VAR)
== ERANGE)
#ifdef NEED_H_ERRNO
- && h_errno_tmp == NETDB_INTERNAL
+ && h_errno == NETDB_INTERNAL
#endif
)
{
@@ -165,11 +162,6 @@ done:
__resolv_context_put (res_ctx);
#endif
-#ifdef NEED_H_ERRNO
- if (h_errno_tmp != 0)
- __set_h_errno (h_errno_tmp);
-#endif
-
return result;
}