From 4cc738f7630b383c10a70b906d64e3b53daeb8d6 Mon Sep 17 00:00:00 2001 From: Bill Paul Date: Sat, 2 Sep 1995 04:16:21 +0000 Subject: [PATCH] Clear up a minor bogosity in yp_match(): we have YPMATCHCACHE turned on, which is fine, except that _yp_dobind() is called before we check the cache. The means we can return from the cache check (if we have a hit) without calling _yp_unbind(). We should do the cache check first and _then_ drop into the section that binds the server and does the yp_match query. --- lib/libc/yp/yplib.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/libc/yp/yplib.c b/lib/libc/yp/yplib.c index 5e5a65538d9..3d9e2caeadc 100644 --- a/lib/libc/yp/yplib.c +++ b/lib/libc/yp/yplib.c @@ -28,7 +28,7 @@ */ #ifndef LINT -static char *rcsid = "$Id: yplib.c,v 1.10 1995/05/30 05:42:15 rgrimes Exp $"; +static char *rcsid = "$Id: yplib.c,v 1.11 1995/07/05 06:04:20 wpaul Exp $"; #endif #include @@ -423,10 +423,6 @@ int *outvallen; indomain == NULL || !strlen(indomain)) return YPERR_BADARGS; -again: - if( _yp_dobind(indomain, &ysd) != 0) - return YPERR_DOMAIN; - #ifdef YPMATCHCACHE if( !strcmp(_yp_domain, indomain) && ypmatch_find(inmap, inkey, inkeylen, &yprv.valdat.dptr, &yprv.valdat.dsize)) { @@ -438,6 +434,10 @@ again: } #endif +again: + if( _yp_dobind(indomain, &ysd) != 0) + return YPERR_DOMAIN; + tv.tv_sec = _yplib_timeout; tv.tv_usec = 0;