chiark / gitweb /
nss: always explicitly reset all error variables
[elogind.git] / src / nss-myhostname / nss-myhostname.c
index bf1e31113713be7e7e6289b49c02394ea9013ad5..08d70f6c0d74a3ee790fc6d8702f7591663ab05f 100644 (file)
@@ -165,6 +165,11 @@ enum nss_status _nss_myhostname_gethostbyname4_r(
         if (ttlp)
                 *ttlp = 0;
 
+        /* Explicitly reset all error variables */
+        *errnop = 0;
+        *h_errnop = NETDB_SUCCESS;
+        h_errno = 0;
+
         return NSS_STATUS_SUCCESS;
 }
 
@@ -289,6 +294,11 @@ static enum nss_status fill_in_hostent(
         if (canonp)
                 *canonp = r_name;
 
+        /* Explicitly reset all error variables */
+        *errnop = 0;
+        *h_errnop = NETDB_SUCCESS;
+        h_errno = 0;
+
         return NSS_STATUS_SUCCESS;
 }