diff options
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/rpc/pmap_clnt.c | 18 | ||||
-rw-r--r-- | lib/libc/rpc/pmap_getmaps.c | 10 | ||||
-rw-r--r-- | lib/libc/rpc/pmap_getport.c | 10 | ||||
-rw-r--r-- | lib/libc/rpc/pmap_rmt.c | 13 | ||||
-rw-r--r-- | lib/libc/rpc/svc_tcp.c | 6 | ||||
-rw-r--r-- | lib/libc/rpc/svc_udp.c | 6 |
6 files changed, 33 insertions, 30 deletions
diff --git a/lib/libc/rpc/pmap_clnt.c b/lib/libc/rpc/pmap_clnt.c index 7fac9416c72..5aadd8d081c 100644 --- a/lib/libc/rpc/pmap_clnt.c +++ b/lib/libc/rpc/pmap_clnt.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: pmap_clnt.c,v 1.6 1996/08/20 21:15:40 deraadt Exp $"; +static char *rcsid = "$OpenBSD: pmap_clnt.c,v 1.7 1997/07/09 03:05:03 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -60,7 +60,7 @@ pmap_set(program, version, protocol, port) u_short port; { struct sockaddr_in myaddress; - int socket = -1; + int sock = -1; register CLIENT *client; struct pmap parms; bool_t rslt; @@ -69,7 +69,7 @@ pmap_set(program, version, protocol, port) return (FALSE); myaddress.sin_addr.s_addr = htonl(INADDR_LOOPBACK); client = clntudp_bufcreate(&myaddress, PMAPPROG, PMAPVERS, - timeout, &socket, RPCSMALLMSGSIZE, RPCSMALLMSGSIZE); + timeout, &sock, RPCSMALLMSGSIZE, RPCSMALLMSGSIZE); if (client == (CLIENT *)NULL) return (FALSE); parms.pm_prog = program; @@ -82,8 +82,8 @@ pmap_set(program, version, protocol, port) return (FALSE); } CLNT_DESTROY(client); - if (socket != -1) - (void)close(socket); + if (sock != -1) + (void)close(sock); return (rslt); } @@ -97,7 +97,7 @@ pmap_unset(program, version) u_long version; { struct sockaddr_in myaddress; - int socket = -1; + int sock = -1; register CLIENT *client; struct pmap parms; bool_t rslt; @@ -106,7 +106,7 @@ pmap_unset(program, version) return (FALSE); myaddress.sin_addr.s_addr = htonl(INADDR_LOOPBACK); client = clntudp_bufcreate(&myaddress, PMAPPROG, PMAPVERS, - timeout, &socket, RPCSMALLMSGSIZE, RPCSMALLMSGSIZE); + timeout, &sock, RPCSMALLMSGSIZE, RPCSMALLMSGSIZE); if (client == (CLIENT *)NULL) return (FALSE); parms.pm_prog = program; @@ -115,7 +115,7 @@ pmap_unset(program, version) CLNT_CALL(client, PMAPPROC_UNSET, xdr_pmap, &parms, xdr_bool, &rslt, tottimeout); CLNT_DESTROY(client); - if (socket != -1) - (void)close(socket); + if (sock != -1) + (void)close(sock); return (rslt); } diff --git a/lib/libc/rpc/pmap_getmaps.c b/lib/libc/rpc/pmap_getmaps.c index b7a822bc336..e49c32a3003 100644 --- a/lib/libc/rpc/pmap_getmaps.c +++ b/lib/libc/rpc/pmap_getmaps.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: pmap_getmaps.c,v 1.4 1996/12/10 07:46:39 deraadt Exp $"; +static char *rcsid = "$OpenBSD: pmap_getmaps.c,v 1.5 1997/07/09 03:05:04 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -60,7 +60,7 @@ pmap_getmaps(address) struct sockaddr_in *address; { struct pmaplist *head = (struct pmaplist *)NULL; - int socket = -1; + int sock = -1; struct timeval minutetimeout; register CLIENT *client; @@ -68,7 +68,7 @@ pmap_getmaps(address) minutetimeout.tv_usec = 0; address->sin_port = htons(PMAPPORT); client = clnttcp_create(address, PMAPPROG, - PMAPVERS, &socket, 50, 500); + PMAPVERS, &sock, 50, 500); if (client != (CLIENT *)NULL) { if (CLNT_CALL(client, PMAPPROC_DUMP, xdr_void, NULL, xdr_pmaplist, &head, minutetimeout) != RPC_SUCCESS) { @@ -76,8 +76,8 @@ pmap_getmaps(address) } CLNT_DESTROY(client); } - if (socket != -1) - (void)close(socket); + if (sock != -1) + (void)close(sock); address->sin_port = 0; return (head); } diff --git a/lib/libc/rpc/pmap_getport.c b/lib/libc/rpc/pmap_getport.c index 07e21910111..651cf265f6c 100644 --- a/lib/libc/rpc/pmap_getport.c +++ b/lib/libc/rpc/pmap_getport.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: pmap_getport.c,v 1.4 1996/12/10 07:46:41 deraadt Exp $"; +static char *rcsid = "$OpenBSD: pmap_getport.c,v 1.5 1997/07/09 03:05:04 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -60,13 +60,13 @@ pmap_getport(address, program, version, protocol) u_int protocol; { u_short port = 0; - int socket = -1; + int sock = -1; register CLIENT *client; struct pmap parms; address->sin_port = htons(PMAPPORT); client = clntudp_bufcreate(address, PMAPPROG, - PMAPVERS, timeout, &socket, RPCSMALLMSGSIZE, RPCSMALLMSGSIZE); + PMAPVERS, timeout, &sock, RPCSMALLMSGSIZE, RPCSMALLMSGSIZE); if (client != (CLIENT *)NULL) { parms.pm_prog = program; parms.pm_vers = version; @@ -81,8 +81,8 @@ pmap_getport(address, program, version, protocol) } CLNT_DESTROY(client); } - if (socket != -1) - (void)close(socket); + if (sock != -1) + (void)close(sock); address->sin_port = 0; return (port); } diff --git a/lib/libc/rpc/pmap_rmt.c b/lib/libc/rpc/pmap_rmt.c index 6afb09ada5f..befeadae989 100644 --- a/lib/libc/rpc/pmap_rmt.c +++ b/lib/libc/rpc/pmap_rmt.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: pmap_rmt.c,v 1.14 1997/01/22 18:50:41 deraadt Exp $"; +static char *rcsid = "$OpenBSD: pmap_rmt.c,v 1.15 1997/07/09 03:05:05 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -73,14 +73,14 @@ pmap_rmtcall(addr, prog, vers, proc, xdrargs, argsp, xdrres, resp, tout, port_pt struct timeval tout; u_long *port_ptr; { - int socket = -1; + int sock = -1; register CLIENT *client; struct rmtcallargs a; struct rmtcallres r; enum clnt_stat stat; addr->sin_port = htons(PMAPPORT); - client = clntudp_create(addr, PMAPPROG, PMAPVERS, timeout, &socket); + client = clntudp_create(addr, PMAPPROG, PMAPVERS, timeout, &sock); if (client != (CLIENT *)NULL) { a.prog = prog; a.vers = vers; @@ -96,8 +96,8 @@ pmap_rmtcall(addr, prog, vers, proc, xdrargs, argsp, xdrres, resp, tout, port_pt } else { stat = RPC_FAILED; } - if (socket != -1) - (void)close(socket); + if (sock != -1) + (void)close(sock); addr->sin_port = 0; return (stat); } @@ -245,7 +245,7 @@ clnt_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult) XDR xdr_stream; register XDR *xdrs = &xdr_stream; int outlen, inlen, fromlen, nets; - register int sock; + register int sock = -1; int on = 1; fd_set *fds, readfds; register int i; @@ -414,4 +414,3 @@ done_broad: AUTH_DESTROY(unix_auth); return (stat); } - diff --git a/lib/libc/rpc/svc_tcp.c b/lib/libc/rpc/svc_tcp.c index 75380fb16f6..bd29078b461 100644 --- a/lib/libc/rpc/svc_tcp.c +++ b/lib/libc/rpc/svc_tcp.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: svc_tcp.c,v 1.14 1997/04/30 05:50:17 tholo Exp $"; +static char *rcsid = "$OpenBSD: svc_tcp.c,v 1.15 1997/07/09 03:05:05 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -307,7 +307,9 @@ svctcp_destroy(xprt) register struct tcp_conn *cd = (struct tcp_conn *)xprt->xp_p1; xprt_unregister(xprt); - (void)close(xprt->xp_sock); + if (xprt->xp_sock != -1) + (void)close(xprt->xp_sock); + xprt->xp_sock = -1; if (xprt->xp_port != 0) { /* a rendezvouser socket */ xprt->xp_port = 0; diff --git a/lib/libc/rpc/svc_udp.c b/lib/libc/rpc/svc_udp.c index cebc4a0c89e..2c4d8ac1175 100644 --- a/lib/libc/rpc/svc_udp.c +++ b/lib/libc/rpc/svc_udp.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: svc_udp.c,v 1.6 1997/03/29 06:08:56 deraadt Exp $"; +static char *rcsid = "$OpenBSD: svc_udp.c,v 1.7 1997/07/09 03:05:06 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -267,7 +267,9 @@ svcudp_destroy(xprt) register struct svcudp_data *su = su_data(xprt); xprt_unregister(xprt); - (void)close(xprt->xp_sock); + if (xprt->xp_sock != -1) + (void)close(xprt->xp_sock); + xprt->xp_sock = -1; XDR_DESTROY(&(su->su_xdrs)); mem_free(rpc_buffer(xprt), su->su_iosz); mem_free((caddr_t)su, sizeof(struct svcudp_data)); |