diff options
Diffstat (limited to 'nss')
-rw-r--r-- | nss/getXXbyYY.c | 10 | ||||
-rw-r--r-- | nss/getXXent_r.c | 4 | ||||
-rw-r--r-- | nss/nss_files/files-XXX.c | 2 | ||||
-rw-r--r-- | nss/nss_files/files-alias.c | 1 |
4 files changed, 14 insertions, 3 deletions
diff --git a/nss/getXXbyYY.c b/nss/getXXbyYY.c index 2a84db974a..8449a38973 100644 --- a/nss/getXXbyYY.c +++ b/nss/getXXbyYY.c @@ -56,7 +56,7 @@ /* 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 +# define H_ERRNO_VAR , &h_errno_tmp #else # define H_ERRNO_PARM # define H_ERRNO_VAR @@ -80,6 +80,9 @@ FUNCTION_NAME (ADD_PARAMS) static LOOKUP_TYPE resbuf; LOOKUP_TYPE *result; int save; +#ifdef NEED_H_ERRNO + int h_errno_tmp = 0; +#endif /* Get lock. */ __libc_lock_lock (lock); @@ -110,5 +113,10 @@ FUNCTION_NAME (ADD_PARAMS) __libc_lock_unlock (lock); __set_errno (save); +#ifdef NEED_H_ERRNO + if (h_errno_tmp != 0) + __set_h_errno (h_errno_tmp); +#endif + return result; } diff --git a/nss/getXXent_r.c b/nss/getXXent_r.c index cc47537129..876ad10963 100644 --- a/nss/getXXent_r.c +++ b/nss/getXXent_r.c @@ -262,13 +262,15 @@ INTERNAL (REENTRANT_GETNAME) (LOOKUP_TYPE *resbuf, char *buffer, size_t buflen, if (! no_more) status = (*sfct) (STAYOPEN_TMPVAR); + else + status = NSS_STATUS_NOTFOUND; } while (! no_more && status != NSS_STATUS_SUCCESS); } __libc_lock_unlock (lock); - *result = NSS_STATUS_SUCCESS ? resbuf : NULL; + *result = status == NSS_STATUS_SUCCESS ? resbuf : NULL; return status == NSS_STATUS_SUCCESS ? 0 : -1; } #define do_weak_alias(n1, n2) weak_alias (n1, n2) diff --git a/nss/nss_files/files-XXX.c b/nss/nss_files/files-XXX.c index c741ab6f48..014e2729a4 100644 --- a/nss/nss_files/files-XXX.c +++ b/nss/nss_files/files-XXX.c @@ -201,7 +201,7 @@ CONCAT(_nss_files_get,ENTNAME_r) (struct STRUCTURE *result, if (stream == NULL) status = internal_setent (0); - if (status != NSS_STATUS_SUCCESS) + if (status == NSS_STATUS_SUCCESS) { /* If the last use was not by the getent function we need the position the stream. */ diff --git a/nss/nss_files/files-alias.c b/nss/nss_files/files-alias.c index c6ef49c621..2b0f292d66 100644 --- a/nss/nss_files/files-alias.c +++ b/nss/nss_files/files-alias.c @@ -20,6 +20,7 @@ #include <aliases.h> #include <ctype.h> +#include <errno.h> #include <libc-lock.h> #include <stdlib.h> #include <stdio.h> |