From cc64a2bf113de0f3e81106d137d8b0e973d426a5 Mon Sep 17 00:00:00 2001 From: Bill Paul Date: Fri, 20 Dec 1996 19:41:15 +0000 Subject: Fix for bug noticed by Christoph Kukulies. _yp_dobind() checks to see if a fork() happens (by checking PIDs) and invalidates all bindings if it finds itself in a newly created child process. (This avoids sharing RPC client handles and socket descriptors with the parent, which would be bad.) Unfortunately, it summarily calls clnt_destroy() on the handles, which may result in the destruction of a descriptor that isn't really a socket. This is fixed by replacing the explicit call to clnt_destroy() with a call to _yp_unbind(), which deals with potentially hosed socket descriptors an a safe manner. This is basically a one-liner. Once I confirm that it fixes Christoph's problem, I'd like permission to put it in the 2.2-RELENG branch. --- lib/libc/yp/yplib.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/libc/yp/yplib.c b/lib/libc/yp/yplib.c index 92f8d8f88651a..805f9025e27b0 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.7 1996/11/08 01:10:35 wpaul Exp $"; +static char *rcsid = "$Id: yplib.c,v 1.25 1996/11/08 01:42:02 wpaul Exp $"; #endif #include @@ -79,6 +79,7 @@ extern bool_t xdr_ypresp_master(); int (*ypresp_allfn)(); void *ypresp_data; +static void _yp_unbind __P(( struct dom_binding * )); struct dom_binding *_ypbindlist; static char _yp_domain[MAXHOSTNAMELEN]; int _yplib_timeout = 10; @@ -230,7 +231,7 @@ _yp_dobind(dom, ypdb) ysd = _ypbindlist; while(ysd) { if(ysd->dom_client != NULL) - clnt_destroy(ysd->dom_client); + _yp_unbind(ysd); ysd2 = ysd->dom_pnext; free(ysd); ysd = ysd2; -- cgit v1.3