summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorjraynard <jraynard@FreeBSD.org>1996-06-10 00:49:19 +0000
committerjraynard <jraynard@FreeBSD.org>1996-06-10 00:49:19 +0000
commit27f0bdfba4e8fc628b5a1afaf7e39455291b37de (patch)
treefb98f790b5ece8c1c87c646b39f28df9c086361a /lib
parenta9d801afa6c4bbde4a0661b767edfda1fd5abd8d (diff)
downloadFreeBSD-src-27f0bdfba4e8fc628b5a1afaf7e39455291b37de.zip
FreeBSD-src-27f0bdfba4e8fc628b5a1afaf7e39455291b37de.tar.gz
Code cleanup (part two):
1. Added missing function prototypes. 2. Added missing function return types. 3. Added missing function argument types. 4. Added missing headers for system function prototypes. 5. Corrected casts in select() args. 6. Got rid of more "extern int errno" rubbish. 7. Added extra parentheses around assignment used as truth value. 8. Fixed bug in clnt_{tcp, udp}create() where pointers could be free'd even if they hadn't been successfully malloc()'d.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/rpc/bindresvport.c5
-rw-r--r--lib/libc/rpc/clnt_tcp.c14
-rw-r--r--lib/libc/rpc/clnt_udp.c8
-rw-r--r--lib/libc/rpc/pmap_getmaps.c4
-rw-r--r--lib/libc/rpc/pmap_rmt.c4
-rw-r--r--lib/libc/rpc/svc.c6
-rw-r--r--lib/libc/rpc/svc_run.c11
7 files changed, 30 insertions, 22 deletions
diff --git a/lib/libc/rpc/bindresvport.c b/lib/libc/rpc/bindresvport.c
index c7f93b2..0f20177 100644
--- a/lib/libc/rpc/bindresvport.c
+++ b/lib/libc/rpc/bindresvport.c
@@ -30,7 +30,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)bindresvport.c 1.8 88/02/08 SMI";*/
/*static char *sccsid = "from: @(#)bindresvport.c 2.2 88/07/29 4.0 RPCSRC";*/
-static char *rcsid = "$Id: bindresvport.c,v 1.2 1995/05/30 05:41:13 rgrimes Exp $";
+static char *rcsid = "$Id: bindresvport.c,v 1.3 1995/10/22 14:51:11 phk Exp $";
#endif
/*
@@ -47,14 +47,13 @@ static char *rcsid = "$Id: bindresvport.c,v 1.2 1995/05/30 05:41:13 rgrimes Exp
/*
* Bind a socket to a privileged IP port
*/
-bindresvport(sd, sin)
+int bindresvport(sd, sin)
int sd;
struct sockaddr_in *sin;
{
int res;
static short port;
struct sockaddr_in myaddr;
- extern int errno;
int i;
#define STARTPORT 600
diff --git a/lib/libc/rpc/clnt_tcp.c b/lib/libc/rpc/clnt_tcp.c
index ebe238d..be07090 100644
--- a/lib/libc/rpc/clnt_tcp.c
+++ b/lib/libc/rpc/clnt_tcp.c
@@ -30,7 +30,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)clnt_tcp.c 1.37 87/10/05 Copyr 1984 Sun Micro";*/
/*static char *sccsid = "from: @(#)clnt_tcp.c 2.2 88/08/01 4.0 RPCSRC";*/
-static char *rcsid = "$Id: clnt_tcp.c,v 1.4 1995/10/27 16:56:50 adam Exp $";
+static char *rcsid = "$Id: clnt_tcp.c,v 1.5 1995/12/07 12:50:53 bde Exp $";
#endif
/*
@@ -64,7 +64,9 @@ static char *rcsid = "$Id: clnt_tcp.c,v 1.4 1995/10/27 16:56:50 adam Exp $";
#define MCALL_MSG_SIZE 24
-extern int errno;
+int bindresvport(int sd, struct sockaddr_in *);
+int _rpc_dtablesize(void);
+bool_t xdr_opaque_auth(XDR *, struct opaque_auth *);
static int readtcp();
static int writetcp();
@@ -121,7 +123,7 @@ clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz)
u_int recvsz;
{
CLIENT *h;
- register struct ct_data *ct;
+ register struct ct_data *ct = NULL;
struct timeval now;
struct rpc_msg call_msg;
@@ -219,8 +221,10 @@ fooy:
/*
* Something goofed, free stuff and barf
*/
- mem_free((caddr_t)ct, sizeof(struct ct_data));
- mem_free((caddr_t)h, sizeof(CLIENT));
+ if (ct)
+ mem_free((caddr_t)ct, sizeof(struct ct_data));
+ if (h)
+ mem_free((caddr_t)h, sizeof(CLIENT));
return ((CLIENT *)NULL);
}
diff --git a/lib/libc/rpc/clnt_udp.c b/lib/libc/rpc/clnt_udp.c
index d0da495..28dfddc 100644
--- a/lib/libc/rpc/clnt_udp.c
+++ b/lib/libc/rpc/clnt_udp.c
@@ -30,7 +30,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro";*/
/*static char *sccsid = "from: @(#)clnt_udp.c 2.2 88/08/01 4.0 RPCSRC";*/
-static char *rcsid = "$Id: clnt_udp.c,v 1.5 1995/10/22 14:51:21 phk Exp $";
+static char *rcsid = "$Id: clnt_udp.c,v 1.6 1995/12/07 12:50:54 bde Exp $";
#endif
/*
@@ -50,7 +50,9 @@ static char *rcsid = "$Id: clnt_udp.c,v 1.5 1995/10/22 14:51:21 phk Exp $";
#include <errno.h>
#include <rpc/pmap_clnt.h>
-extern int errno;
+int bindresvport(int sd, struct sockaddr_in *);
+int _rpc_dtablesize(void);
+bool_t xdr_opaque_auth(XDR *, struct opaque_auth *);
/*
* UDP bases client side rpc operations
@@ -117,7 +119,7 @@ clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz)
u_int recvsz;
{
CLIENT *cl;
- register struct cu_data *cu;
+ register struct cu_data *cu = NULL;
struct timeval now;
struct rpc_msg call_msg;
diff --git a/lib/libc/rpc/pmap_getmaps.c b/lib/libc/rpc/pmap_getmaps.c
index cbb1a43..6119fc0 100644
--- a/lib/libc/rpc/pmap_getmaps.c
+++ b/lib/libc/rpc/pmap_getmaps.c
@@ -30,7 +30,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)pmap_getmaps.c 1.10 87/08/11 Copyr 1984 Sun Micro";*/
/*static char *sccsid = "from: @(#)pmap_getmaps.c 2.2 88/08/01 4.0 RPCSRC";*/
-static char *rcsid = "$Id: pmap_getmaps.c,v 1.2 1995/05/30 05:41:23 rgrimes Exp $";
+static char *rcsid = "$Id: pmap_getmaps.c,v 1.3 1995/10/22 14:51:29 phk Exp $";
#endif
/*
@@ -54,8 +54,6 @@ static char *rcsid = "$Id: pmap_getmaps.c,v 1.2 1995/05/30 05:41:23 rgrimes Exp
#define NAMELEN 255
#define MAX_BROADCAST_SIZE 1400
-extern int errno;
-
/*
* Get a copy of the current port maps.
* Calls the pmap service remotely to do get the maps.
diff --git a/lib/libc/rpc/pmap_rmt.c b/lib/libc/rpc/pmap_rmt.c
index 4b907ab..c61769f 100644
--- a/lib/libc/rpc/pmap_rmt.c
+++ b/lib/libc/rpc/pmap_rmt.c
@@ -30,7 +30,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)pmap_rmt.c 1.21 87/08/27 Copyr 1984 Sun Micro";*/
/*static char *sccsid = "from: @(#)pmap_rmt.c 2.2 88/08/01 4.0 RPCSRC";*/
-static char *rcsid = "$Id: pmap_rmt.c,v 1.4 1995/12/07 12:50:55 bde Exp $";
+static char *rcsid = "$Id: pmap_rmt.c,v 1.5 1996/03/17 20:12:53 guido Exp $";
#endif
/*
@@ -55,9 +55,9 @@ static char *rcsid = "$Id: pmap_rmt.c,v 1.4 1995/12/07 12:50:55 bde Exp $";
#include <arpa/inet.h>
#define MAX_BROADCAST_SIZE 1400
-extern int errno;
static struct timeval timeout = { 3, 0 };
++int _rpc_dtablesize(void);
/*
* pmapper remote-call-service interface.
diff --git a/lib/libc/rpc/svc.c b/lib/libc/rpc/svc.c
index 809cbfb..3bc9c1d 100644
--- a/lib/libc/rpc/svc.c
+++ b/lib/libc/rpc/svc.c
@@ -30,7 +30,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)svc.c 1.44 88/02/08 Copyr 1984 Sun Micro";*/
/*static char *sccsid = "from: @(#)svc.c 2.4 88/08/11 4.0 RPCSRC";*/
-static char *rcsid = "$Id: svc.c,v 1.2 1995/05/30 05:41:31 rgrimes Exp $";
+static char *rcsid = "$Id: svc.c,v 1.3 1995/10/22 14:51:34 phk Exp $";
#endif
/*
@@ -49,8 +49,6 @@ static char *rcsid = "$Id: svc.c,v 1.2 1995/05/30 05:41:31 rgrimes Exp $";
#include <rpc/rpc.h>
#include <rpc/pmap_clnt.h>
-extern int errno;
-
#ifdef FD_SETSIZE
static SVCXPRT **xports;
#else
@@ -62,6 +60,8 @@ static SVCXPRT *xports[NOFILE];
#define NULL_SVC ((struct svc_callout *)0)
#define RQCRED_SIZE 400 /* this size is excessive */
+int _rpc_dtablesize(void);
+
/*
* The services list
* Each entry represents a set of procedures (an rpc program).
diff --git a/lib/libc/rpc/svc_run.c b/lib/libc/rpc/svc_run.c
index 730acd3..5c84864 100644
--- a/lib/libc/rpc/svc_run.c
+++ b/lib/libc/rpc/svc_run.c
@@ -30,7 +30,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)svc_run.c 1.1 87/10/13 Copyr 1984 Sun Micro";*/
/*static char *sccsid = "from: @(#)svc_run.c 2.1 88/07/29 4.0 RPCSRC";*/
-static char *rcsid = "$Id: svc_run.c,v 1.1 1994/08/07 18:36:09 wollman Exp $";
+static char *rcsid = "$Id: svc_run.c,v 1.2 1995/05/30 05:41:35 rgrimes Exp $";
#endif
/*
@@ -38,7 +38,13 @@ static char *rcsid = "$Id: svc_run.c,v 1.1 1994/08/07 18:36:09 wollman Exp $";
* Wait for input, call server program.
*/
#include <rpc/rpc.h>
+#include <stdio.h>
#include <sys/errno.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <unistd.h>
+
+int _rpc_dtablesize(void);
void
svc_run()
@@ -48,7 +54,6 @@ svc_run()
#else
int readfds;
#endif /* def FD_SETSIZE */
- extern int errno;
for (;;) {
#ifdef FD_SETSIZE
@@ -56,7 +61,7 @@ svc_run()
#else
readfds = svc_fds;
#endif /* def FD_SETSIZE */
- switch (select(_rpc_dtablesize(), &readfds, (int *)0, (int *)0,
+ switch (select(_rpc_dtablesize(), &readfds, NULL, NULL,
(struct timeval *)0)) {
case -1:
if (errno == EINTR) {
OpenPOWER on IntegriCloud