aboutsummaryrefslogtreecommitdiff
path: root/nss/getXXbyYY_r.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-08-27 08:32:50 +0000
committerUlrich Drepper <drepper@redhat.com>2002-08-27 08:32:50 +0000
commitb2ab1f5df8dac098eea5058f02f4d03c4143d5a2 (patch)
treea2291d0da5c68deb1ae712d971097a9853d30a10 /nss/getXXbyYY_r.c
parentb50f38778c306b3f0ec0c3ed05acf9ce10508aa4 (diff)
downloadglibc-b2ab1f5df8dac098eea5058f02f4d03c4143d5a2.tar
glibc-b2ab1f5df8dac098eea5058f02f4d03c4143d5a2.tar.gz
glibc-b2ab1f5df8dac098eea5058f02f4d03c4143d5a2.tar.bz2
glibc-b2ab1f5df8dac098eea5058f02f4d03c4143d5a2.zip
Update.
2002-08-27 Ulrich Drepper <drepper@redhat.com> * nss/getXXbyYY_r.c (REENTRANT_NAME): If no service is available set h_errno to NO_RECOVERY [PR libc/4360].
Diffstat (limited to 'nss/getXXbyYY_r.c')
-rw-r--r--nss/getXXbyYY_r.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/nss/getXXbyYY_r.c b/nss/getXXbyYY_r.c
index 06aebb4ab0..630cea4158 100644
--- a/nss/getXXbyYY_r.c
+++ b/nss/getXXbyYY_r.c
@@ -19,6 +19,7 @@
#include <assert.h>
#include <errno.h>
+#include <stdbool.h>
#include "nsswitch.h"
#ifdef USE_NSCD
# include <nscd/nscd_proto.h>
@@ -135,6 +136,9 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
#ifdef USE_NSCD
int nscd_status;
#endif
+#ifdef NEED_H_ERRNO
+ bool any_service = false;
+#endif
#ifdef PREPROCESS
PREPROCESS;
@@ -203,6 +207,10 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
while (no_more == 0)
{
+#ifdef NEED_H_ERRNO
+ any_service = true;
+#endif
+
status = DL_CALL_FCT (fct, (ADD_VARIABLES, resbuf, buffer, buflen,
&errno H_ERRNO_VAR));
@@ -226,6 +234,11 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
done:
#endif
*result = status == NSS_STATUS_SUCCESS ? resbuf : NULL;
+#ifdef NEED_H_ERRNO
+ if (status != NSS_STATUS_SUCCESS && ! any_service)
+ /* We were not able to use any service. */
+ *h_errnop = NO_RECOVERY;
+#endif
#ifdef POSTPROCESS
POSTPROCESS;
#endif