From 6ff5bc683740fb47bf573c670db71d1796f008ad Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 28 Sep 1998 23:58:33 +0000 Subject: Update. 1998-09-28 23:55 Ulrich Drepper * nis/ypclnt.c (__yp_bind): Pretty print. Optimize readv result check a bit. Also close socket of domain client. Close socket in IPPORT_RESERVED error case. 1998-09-28 Ulrich Drepper * sysdeps/unix/sysv/linux/bits/socket.h (__cmsg_nxthdr): Use CMSG_ALIGN (fixes a bug) and correct test for availability of another entry. * sysdeps/unix/sysv/linux/mips/bits/socket.h: Sync with generic Linux version. (__cmsg_nxthdr): Use CMSG_ALIGN (fixes a bug) and correct test for availability of another entry. Patch by ak@muc.de. * sysdeps/unix/sysv/linux/netinet/ip.h (IPOPT_NOOP): Fix typo. Patch by ak@muc.de. 1998-09-27 Andreas Schwab * posix/annexc.c (xsystem): New function. Use it instead of system. 1998-09-28 Ulrich Drepper * stdlib/longlong.h: Remove #endif for #if removed in last change. --- nis/ypclnt.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'nis/ypclnt.c') diff --git a/nis/ypclnt.c b/nis/ypclnt.c index 94fce94f9d..aa81655f91 100644 --- a/nis/ypclnt.c +++ b/nis/ypclnt.c @@ -64,7 +64,7 @@ __yp_bind (const char *domain, dom_binding **ypdb) int is_new = 0; int try; - if ((domain == NULL) || (domain[0] == '\0')) + if (domain == NULL || domain[0] == '\0') return YPERR_BADARGS; if (ypdb != NULL) @@ -116,10 +116,8 @@ __yp_bind (const char *domain, dom_binding **ypdb) vec[1].iov_base = &ypbr; vec[1].iov_len = sizeof (ypbr); - if (readv (fd, vec, 2) == vec[0].iov_len + vec[1].iov_len) + if (readv (fd, vec, 2) == sizeof (port) + sizeof (ypbr)) { - memset (&ysd->dom_server_addr, '\0', - sizeof ysd->dom_server_addr); ysd->dom_server_addr.sin_family = AF_INET; memcpy (&ysd->dom_server_addr.sin_port, ypbr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_port, @@ -138,9 +136,10 @@ __yp_bind (const char *domain, dom_binding **ypdb) if (ysd->dom_vers == -1) { - if(ysd->dom_client) + if (ysd->dom_client) { clnt_destroy(ysd->dom_client); + close (ysd->dom_socket); ysd->dom_client = NULL; ysd->dom_socket = -1; } @@ -164,6 +163,7 @@ __yp_bind (const char *domain, dom_binding **ypdb) if (ntohs (clnt_saddr.sin_port) >= IPPORT_RESERVED) { clnt_destroy (client); + close (clnt_sock); if (is_new) free (ysd); return YPERR_YPBIND; @@ -205,11 +205,6 @@ __yp_bind (const char *domain, dom_binding **ypdb) ysd->dom_domain[YPMAXDOMAIN] = '\0'; } - if (ysd->dom_client) - { - clnt_destroy (ysd->dom_client); - close (ysd->dom_socket); - } ysd->dom_socket = RPC_ANYSOCK; ysd->dom_client = clntudp_create (&ysd->dom_server_addr, YPPROG, YPVERS, UDPTIMEOUT, &ysd->dom_socket); -- cgit 1.4.1