aboutsummaryrefslogtreecommitdiff
path: root/nis/ypclnt.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-09-28 23:58:33 +0000
committerUlrich Drepper <drepper@redhat.com>1998-09-28 23:58:33 +0000
commit6ff5bc683740fb47bf573c670db71d1796f008ad (patch)
tree2bb24e10a14d530f90ba390131200c738d927b44 /nis/ypclnt.c
parente07a51b539aee5663361a60f6b3f7a5a75df52d5 (diff)
downloadglibc-6ff5bc683740fb47bf573c670db71d1796f008ad.tar
glibc-6ff5bc683740fb47bf573c670db71d1796f008ad.tar.gz
glibc-6ff5bc683740fb47bf573c670db71d1796f008ad.tar.bz2
glibc-6ff5bc683740fb47bf573c670db71d1796f008ad.zip
Update.
1998-09-28 23:55 Ulrich Drepper <drepper@cygnus.com> * 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 <drepper@cygnus.com> * 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 <schwab@issan.informatik.uni-dortmund.de> * posix/annexc.c (xsystem): New function. Use it instead of system. 1998-09-28 Ulrich Drepper <drepper@cygnus.com> * stdlib/longlong.h: Remove #endif for #if removed in last change.
Diffstat (limited to 'nis/ypclnt.c')
-rw-r--r--nis/ypclnt.c15
1 files changed, 5 insertions, 10 deletions
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);