summaryrefslogtreecommitdiff
path: root/lib/libc/rpc/clnt_tcp.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-12-10 07:46:44 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-12-10 07:46:44 +0000
commit0de13dae2234e314b5c890da4f2d99c3dca29182 (patch)
tree847aca1e828698cedf65411731e107f2893f6d7f /lib/libc/rpc/clnt_tcp.c
parent4a24468ccf5c7f1ade97c67ece7cad2e265b6b74 (diff)
avoid close(-1) cases
Diffstat (limited to 'lib/libc/rpc/clnt_tcp.c')
-rw-r--r--lib/libc/rpc/clnt_tcp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libc/rpc/clnt_tcp.c b/lib/libc/rpc/clnt_tcp.c
index 694ebeb7f53..3cc332244ad 100644
--- a/lib/libc/rpc/clnt_tcp.c
+++ b/lib/libc/rpc/clnt_tcp.c
@@ -28,7 +28,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: clnt_tcp.c,v 1.10 1996/11/14 06:17:36 etheisen Exp $";
+static char *rcsid = "$OpenBSD: clnt_tcp.c,v 1.11 1996/12/10 07:46:37 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -163,7 +163,8 @@ clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz)
sizeof(*raddr)) < 0)) {
rpc_createerr.cf_stat = RPC_SYSTEMERROR;
rpc_createerr.cf_error.re_errno = errno;
- (void)close(*sockp);
+ if (*sockp != -1)
+ (void)close(*sockp);
goto fooy;
}
ct->ct_closeit = TRUE;