From 11fb5722e2f671a26c53af2c2c4ddf4dbf12be4b Mon Sep 17 00:00:00 2001 From: wpaul Date: Tue, 19 Mar 1996 19:27:03 +0000 Subject: Fix yp_all() so that it doesn't bogusly return YP_NOMORE at the end of a successful map retrieval. (This has to do with a previous change to xdr_ypresp_all_seq() and ypxfr_get_map(); originally, yp_all() would look for a return value of YP_FALSE to signal success, but now it should be looking for YP_NOMORE. It should not be passing YP_NOMORE back up to the caller though.) Noticed by: There is also another small bug here, which is that the call to xdr_free() that happens immediately after the clnt_call() in yp_all() clobbers the return status value. I've worked around this for now, but I think the xdr_free() is actually bogus and should be removed. I want to check some more before I do that though. --- lib/libc/yp/yplib.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/libc/yp/yplib.c b/lib/libc/yp/yplib.c index 9614fb0..1043fe2 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.13 1995/11/05 05:39:04 wpaul Exp $"; +static char *rcsid = "$Id: yplib.c,v 1.15 1995/12/15 03:26:40 wpaul Exp $"; #endif #include @@ -649,7 +649,7 @@ struct ypall_callback *incallback; struct timeval tv; struct sockaddr_in clnt_sin; CLIENT *clnt; - u_long status; + u_long status, savstat; int clnt_sock; /* Sanity check */ @@ -680,11 +680,12 @@ struct ypall_callback *incallback; (void) clnt_call(clnt, YPPROC_ALL, xdr_ypreq_nokey, &yprnk, xdr_ypresp_all_seq, &status, tv); clnt_destroy(clnt); + savstat = status; xdr_free(xdr_ypresp_all_seq, (char *)&status); /* not really needed... */ _yp_unbind(ysd); - if(status != YP_FALSE) - return ypprot_err(status); + if(savstat != YP_NOMORE) + return ypprot_err(savstat); return 0; } -- cgit v1.1