summaryrefslogtreecommitdiff
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
parent4a24468ccf5c7f1ade97c67ece7cad2e265b6b74 (diff)
avoid close(-1) cases
-rw-r--r--lib/libc/rpc/clnt_simple.c5
-rw-r--r--lib/libc/rpc/clnt_tcp.c5
-rw-r--r--lib/libc/rpc/pmap_getmaps.c5
-rw-r--r--lib/libc/rpc/pmap_getport.c5
-rw-r--r--lib/libc/rpc/pmap_rmt.c5
5 files changed, 15 insertions, 10 deletions
diff --git a/lib/libc/rpc/clnt_simple.c b/lib/libc/rpc/clnt_simple.c
index 20071c9b15f..bc127b03d9a 100644
--- a/lib/libc/rpc/clnt_simple.c
+++ b/lib/libc/rpc/clnt_simple.c
@@ -28,7 +28,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: clnt_simple.c,v 1.5 1996/12/10 07:43:34 deraadt Exp $";
+static char *rcsid = "$OpenBSD: clnt_simple.c,v 1.6 1996/12/10 07:46:33 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -80,7 +80,8 @@ callrpc(host, prognum, versnum, procnum, inproc, in, outproc, out)
/* reuse old client */
} else {
crp->valid = 0;
- (void)close(crp->socket);
+ if (crp->socket != -1)
+ (void)close(crp->socket);
crp->socket = RPC_ANYSOCK;
if (crp->client) {
clnt_destroy(crp->client);
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;
diff --git a/lib/libc/rpc/pmap_getmaps.c b/lib/libc/rpc/pmap_getmaps.c
index be6cd8fc466..b7a822bc336 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.3 1996/08/19 08:31:37 tholo Exp $";
+static char *rcsid = "$OpenBSD: pmap_getmaps.c,v 1.4 1996/12/10 07:46:39 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -76,7 +76,8 @@ pmap_getmaps(address)
}
CLNT_DESTROY(client);
}
- (void)close(socket);
+ if (socket != -1)
+ (void)close(socket);
address->sin_port = 0;
return (head);
}
diff --git a/lib/libc/rpc/pmap_getport.c b/lib/libc/rpc/pmap_getport.c
index 89e867e8f57..07e21910111 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.3 1996/08/19 08:31:38 tholo Exp $";
+static char *rcsid = "$OpenBSD: pmap_getport.c,v 1.4 1996/12/10 07:46:41 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -81,7 +81,8 @@ pmap_getport(address, program, version, protocol)
}
CLNT_DESTROY(client);
}
- (void)close(socket);
+ if (socket != -1)
+ (void)close(socket);
address->sin_port = 0;
return (port);
}
diff --git a/lib/libc/rpc/pmap_rmt.c b/lib/libc/rpc/pmap_rmt.c
index 5d205e75e5e..00c02545764 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.11 1996/11/14 06:23:50 etheisen Exp $";
+static char *rcsid = "$OpenBSD: pmap_rmt.c,v 1.12 1996/12/10 07:46:43 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -96,7 +96,8 @@ pmap_rmtcall(addr, prog, vers, proc, xdrargs, argsp, xdrres, resp, tout, port_pt
} else {
stat = RPC_FAILED;
}
- (void)close(socket);
+ if (socket != -1)
+ (void)close(socket);
addr->sin_port = 0;
return (stat);
}