about summary refs log tree commit diff
path: root/nss/getXXbyYY_r.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-03-05 14:03:24 +0000
committerUlrich Drepper <drepper@redhat.com>1998-03-05 14:03:24 +0000
commitea278354429c511389edab51dcb588343652601d (patch)
treea78e3c472ce68aa2d1b1e5b415edd5f68e8969ec /nss/getXXbyYY_r.c
parent2eb45444a74df5f8d47ba14e318aff2e78a915db (diff)
downloadglibc-ea278354429c511389edab51dcb588343652601d.tar.gz
glibc-ea278354429c511389edab51dcb588343652601d.tar.xz
glibc-ea278354429c511389edab51dcb588343652601d.zip
Update.
1998-03-05  Ulrich Drepper  <drepper@cygnus.com>

	* elf/rtld.c: Speed up processing of environment variables.  Do
	only one run on the environment by avoiding to call getenv.
	* sysdeps/generic/dl-sysdep.c (_dl_next_ld_env_entry): New
	function.  Used by patch above.

1998-03-05 10:25  Ulrich Drepper  <drepper@cygnus.com>

	* nss/getXXbyYY_r.c: Don't try to contact nscd every time when it
	failed.  Only do this every NSS_NSCD_RETRY times.
	* nss/nsswitch.c: Define __nss_nscd_not_available, used by above
	change.
	* nscd/nscd_getgr_r.c (__nscd_getgr_r): Return 2 if contacting the
	daemon failed.
	* nscd/nscd_getpw_r.c (__nscd_getpw_r): Likewise.

1998-03-05  Ulrich Drepper  <drepper@cygnus.com>

	* nss/nsswitch.c (nss_lookup_function): Don't modify errno if NSS
	module cannot be found.  Reported by Andreas Jaeger.

1998-03-05 11:40  Franz Sirl <Franz.Sirl-kernel@lauterbach.com>

	* nscd/nscd_getgr_r.c: Change char to int to avoid compiler warning
	on platforms which default to unsigned chars.
	* nscd/nscd_getpw_r.c: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/sysdep.h: Undefine L before
	defining it.

1998-03-05  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* elf/Makefile (install-bin): Change = to += for sprof to install
	ldd also.
Diffstat (limited to 'nss/getXXbyYY_r.c')
-rw-r--r--nss/getXXbyYY_r.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/nss/getXXbyYY_r.c b/nss/getXXbyYY_r.c
index a4dc0011a2..8a38b0d628 100644
--- a/nss/getXXbyYY_r.c
+++ b/nss/getXXbyYY_r.c
@@ -88,6 +88,12 @@ extern struct __res_state _res;
 /* The lookup function for the first entry of this service.  */
 extern int DB_LOOKUP_FCT (service_user **nip, const char *name, void **fctp);
 
+/* Nonzero if the NSCD is not available.  This variable will be increased
+   whenever we try to use the NSCD but see it is not avilable.  So we
+   can recheck the presence every once in a while.  */
+extern int __nss_nscd_not_available;
+/* Interval in which we transfer retry to contact the NSCD.  */
+#define NSS_NSCD_RETRY	100
 
 
 int
@@ -111,11 +117,21 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
 #endif
 
 #ifdef USE_NSCD
-  nscd_status = NSCD_NAME (ADD_VARIABLES, resbuf, buffer, buflen H_ERRNO_VAR);
-  if (nscd_status < 1)
+  if (__nss_nscd_not_available && ++__nss_nscd_not_available > NSS_NSCD_RETRY)
+    __nss_nscd_not_available = 0;
+
+  if (!__nss_nscd_not_available)
     {
-      *result = nscd_status == 0 ? resbuf : NULL;
-      return nscd_status;
+      nscd_status = NSCD_NAME (ADD_VARIABLES, resbuf, buffer, buflen
+			       H_ERRNO_VAR);
+      if (nscd_status < 1)
+	{
+	  *result = nscd_status == 0 ? resbuf : NULL;
+	  return nscd_status;
+	}
+      if (nscd_status == 2)
+	/* This return value indicates that contacting the server failed.  */
+	__nss_nscd_not_available = 1;
     }
 #endif
 
@@ -152,7 +168,7 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
       status = (*fct) (ADD_VARIABLES, resbuf, buffer, buflen,
 		       __errno_location () H_ERRNO_VAR);
 
-      /* The the status is NSS_STATUS_TRYAGAIN and errno is ERANGE the
+      /* The status is NSS_STATUS_TRYAGAIN and errno is ERANGE the
 	 provided buffer is too small.  In this case we should give
 	 the user the possibility to enlarge the buffer and we should
 	 not simply go on with the next service (even if the TRYAGAIN