This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] nss: Use h_errno directly in getXXbyYY


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;
 }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]