about summary refs log tree commit diff
path: root/nis/nis_findserv.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-08-29 23:31:38 +0000
committerUlrich Drepper <drepper@redhat.com>2001-08-29 23:31:38 +0000
commit6c3ebebd1eddb7041248125fa5e228380400c436 (patch)
tree14a5a9363c4e2b3fa3b2998ce6cedaa36dae480f /nis/nis_findserv.c
parent07627f49f9f262cd1337a53009b216b3b6fe64f6 (diff)
downloadglibc-6c3ebebd1eddb7041248125fa5e228380400c436.tar.gz
glibc-6c3ebebd1eddb7041248125fa5e228380400c436.tar.xz
glibc-6c3ebebd1eddb7041248125fa5e228380400c436.zip
Update.
2001-08-29  Ulrich Drepper  <drepper@redhat.com>

	* nis/nis_findserv.c (__nis_findfastest): Don't fail if reply received
	first is from a previous call.
	Patch by Alexander Belopolsky <alexb@rentec.com> for [PR libc/3670].

2001-08-29  Andreas Schwab  <schwab@suse.de>

	* sysdeps/ia64/fpu/libm-test-ulps: Updated.

2001-08-25  Maciej W. Rozycki  <macro@ds2.pg.gda.pl>

	* config.make.in (INSTALL_SCRIPT): Define.
	* Makeconfig (INSTALL_SCRIPT): Define.
	* Makerules (do-install-script): New macro to install scripts using
	INSTALL_SCRIPT.
	(install-bin-script): New rule to install scripts with
	do-install-script.
	(install-bin-script-nosubdir): New rule.
	(install-no-libc.a-nosubdir): Add install-bin-script-nosubdir.
	(distinfo-vars): Add $(install-bin-script).
	* Rules (others): Likewise.
	* Makefile (glibcbug): Install with install-bin-script.
	* debug/Makefile (xtrace): Likewise.
	(catchsegv): Likewise.
	* elf/Makefile (ldd): Likewise.
	* malloc/Makefile (mtrace): Likewise.
	* timezone/Makefile (tzselect): Likewise.

2001-08-29  H.J. Lu  <hjl@gnu.org>

	* sysdeps/mips/dl-machine.h (__dl_runtime_resolve): Pass
	ELF_RTYPE_CLASS_PLT, instead of R_MIPS_REL32, to
	_dl_lookup_versioned_symbol () and _dl_lookup_symbol ().

	Add it to LDFLAGS.so, LDFLAGS-rtld, and +link.
Diffstat (limited to 'nis/nis_findserv.c')
-rw-r--r--nis/nis_findserv.c45
1 files changed, 23 insertions, 22 deletions
diff --git a/nis/nis_findserv.c b/nis/nis_findserv.c
index 8152f55fb3..a82c1154ab 100644
--- a/nis/nis_findserv.c
+++ b/nis/nis_findserv.c
@@ -135,12 +135,10 @@ __nis_findfastest (dir_binding *bind)
   struct findserv_req *pings;
   struct sockaddr_in sin, saved_sin;
   int found = -1;
-  u_int32_t xid_seed, xid_lookup;
+  u_int32_t xid_seed;
   int sock, dontblock = 1;
   CLIENT *clnt;
-  char clnt_res;
-  void *foo = NULL;
-  u_long i, j, pings_count, pings_max;
+  u_long i, j, pings_count, pings_max, fastest = -1;
   struct cu_data *cu;
 
   pings_max = bind->server_len * 2;	/* Reserve a little bit more memory
@@ -188,10 +186,9 @@ __nis_findfastest (dir_binding *bind)
 	    memcpy ((char *) &pings[pings_count].sin, (char *) &sin,
 		    sizeof (sin));
 	    memcpy ((char *)&saved_sin, (char *)&sin, sizeof(sin));
-	    pings[pings_count].xid = xid_seed;
+	    pings[pings_count].xid = xid_seed + pings_count;
 	    pings[pings_count].server_nr = i;
 	    pings[pings_count].server_ep = j;
-	    ++xid_seed;
 	    ++pings_count;
 	  }
 
@@ -225,26 +222,30 @@ __nis_findfastest (dir_binding *bind)
       memcpy ((char *) &cu->cu_raddr, (char *) &pings[i].sin,
 	      sizeof (struct sockaddr_in));
       /* Transmit to NULLPROC, return immediately. */
-      clnt_call (clnt, NULLPROC, (xdrproc_t) xdr_void, (caddr_t) foo,
-		 (xdrproc_t) xdr_void, (caddr_t) & clnt_res, TIMEOUT00);
+      clnt_call (clnt, NULLPROC, 
+		 (xdrproc_t) xdr_void, (caddr_t) 0,
+		 (xdrproc_t) xdr_void, (caddr_t) 0, TIMEOUT00);
     }
-
+  
   /* Receive reply from NULLPROC asynchronously */
-  memset ((char *) &clnt_res, 0, sizeof (clnt_res));
-  clnt_call (clnt, NULLPROC, (xdrproc_t) NULL, (caddr_t) foo,
-	     (xdrproc_t) xdr_void, (caddr_t) &clnt_res, TIMEOUT00);
-
-  xid_lookup = *((u_int32_t *) (cu->cu_inbuf));
-  for (i = 0; i < pings_count; i++)
+  while (RPC_SUCCESS == clnt_call (clnt, NULLPROC,
+				   (xdrproc_t) NULL, (caddr_t) 0,
+				   (xdrproc_t) xdr_void, (caddr_t) 0,
+				   TIMEOUT00))
     {
-      if (pings[i].xid == xid_lookup)
-	{
-	  bind->server_used = pings[i].server_nr;
-	  bind->current_ep = pings[i].server_ep;
-	  found = 1;
-	}
+      fastest = *((u_int32_t *) (cu->cu_inbuf)) - xid_seed;
+      if (fastest < pings_count) {
+	break;
+      }
     }
-
+  
+  if (fastest < pings_count)
+    {
+      bind->server_used = pings[fastest].server_nr;
+      bind->current_ep = pings[fastest].server_ep;
+      found = 1;
+    }
+  
   auth_destroy (clnt->cl_auth);
   clnt_destroy (clnt);
   close (sock);