From f12d1a5dd0b4ac959f98fc3c418b3f1e6d77bfa6 Mon Sep 17 00:00:00 2001 From: James Raynard Date: Mon, 10 Jun 1996 20:13:09 +0000 Subject: Code cleanup: 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 format specifier in printf(). 6. Added extra parentheses around assignment used as truth value. 7. Added missing "default" cases in switch statements. 8. Added casts for function pointers. 9. Did *not* change int declarations of uid and gid to uid_t/gid_t because I don't know if that would affect the protocol. Put in explicit casts to int instead, to make things more obvious. 10. Moved declarations of variables that are only used if YP is defined inside the '#ifdef YP' conditionals. --- lib/libc/rpc/auth_unix.c | 10 ++++++---- lib/libc/rpc/clnt_perror.c | 4 +++- lib/libc/rpc/clnt_simple.c | 5 +++-- lib/libc/rpc/getrpcent.c | 7 ++++--- lib/libc/rpc/pmap_prot2.c | 4 ++-- lib/libc/rpc/rpc_dtablesize.c | 3 ++- lib/libc/rpc/rpc_prot.c | 8 +++++++- lib/libc/rpc/svc_simple.c | 9 ++++++--- lib/libc/rpc/svc_tcp.c | 8 ++++---- 9 files changed, 37 insertions(+), 21 deletions(-) (limited to 'lib/libc') diff --git a/lib/libc/rpc/auth_unix.c b/lib/libc/rpc/auth_unix.c index b63b95954c52..e96eb0879f93 100644 --- a/lib/libc/rpc/auth_unix.c +++ b/lib/libc/rpc/auth_unix.c @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)auth_unix.c 1.19 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)auth_unix.c 2.2 88/08/01 4.0 RPCSRC";*/ -static char *rcsid = "$Id: auth_unix.c,v 1.4 1995/05/30 05:41:12 rgrimes Exp $"; +static char *rcsid = "$Id: auth_unix.c,v 1.5 1995/10/22 14:51:08 phk Exp $"; #endif /* @@ -56,6 +56,8 @@ static char *rcsid = "$Id: auth_unix.c,v 1.4 1995/05/30 05:41:12 rgrimes Exp $"; #include #include +bool_t xdr_opaque_auth(XDR *xdrs, struct opaque_auth *ap); + /* * Unix authenticator operations vector */ @@ -202,13 +204,13 @@ authunix_create_default() if (gethostname(machname, MAX_MACHINE_NAME) == -1) abort(); machname[MAX_MACHINE_NAME] = 0; - uid = geteuid(); - gid = getegid(); + uid = (int)geteuid(); + gid = (int)getegid(); if ((len = getgroups(NGROUPS, real_gids)) < 0) abort(); if(len > NGRPS) len = NGRPS; /* GW: turn `gid_t's into `int's */ for(i = 0; i < len; i++) { - gids[i] = real_gids[i]; + gids[i] = (int)real_gids[i]; } return (authunix_create(machname, uid, gid, len, gids)); } diff --git a/lib/libc/rpc/clnt_perror.c b/lib/libc/rpc/clnt_perror.c index a6ee70b65cfb..0bcd8f048a10 100644 --- a/lib/libc/rpc/clnt_perror.c +++ b/lib/libc/rpc/clnt_perror.c @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)clnt_perror.c 1.15 87/10/07 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)clnt_perror.c 2.1 88/07/29 4.0 RPCSRC";*/ -static char *rcsid = "$Id: clnt_perror.c,v 1.3 1995/10/22 14:51:14 phk Exp $"; +static char *rcsid = "$Id: clnt_perror.c,v 1.4 1995/12/10 17:40:18 wpaul Exp $"; #endif /* @@ -253,6 +253,8 @@ clnt_spcreateerror(s) (void) sprintf(&str[strlen(str)], "Error %d", rpc_createerr.cf_error.re_errno); break; + default: + break; } (void) strcat(str, "\n"); return (str); diff --git a/lib/libc/rpc/clnt_simple.c b/lib/libc/rpc/clnt_simple.c index 2678287f9fca..5dfbc228d1be 100644 --- a/lib/libc/rpc/clnt_simple.c +++ b/lib/libc/rpc/clnt_simple.c @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)clnt_simple.c 1.35 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)clnt_simple.c 2.2 88/08/01 4.0 RPCSRC";*/ -static char *rcsid = "$Id: clnt_simple.c,v 1.2 1995/05/30 05:41:17 rgrimes Exp $"; +static char *rcsid = "$Id: clnt_simple.c,v 1.3 1995/10/22 14:51:17 phk Exp $"; #endif /* @@ -55,8 +55,9 @@ static struct callrpc_private { char *oldhost; } *callrpc_private; -callrpc(host, prognum, versnum, procnum, inproc, in, outproc, out) +int callrpc(host, prognum, versnum, procnum, inproc, in, outproc, out) char *host; + int prognum, versnum, procnum; xdrproc_t inproc, outproc; char *in, *out; { diff --git a/lib/libc/rpc/getrpcent.c b/lib/libc/rpc/getrpcent.c index e9b919c89222..6556e613fc5b 100644 --- a/lib/libc/rpc/getrpcent.c +++ b/lib/libc/rpc/getrpcent.c @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)getrpcent.c 1.14 91/03/11 Copyr 1984 Sun Micro";*/ -static char *rcsid = "$Id: getrpcent.c,v 1.2 1995/05/30 05:41:21 rgrimes Exp $"; +static char *rcsid = "$Id: getrpcent.c,v 1.3 1995/10/22 14:51:24 phk Exp $"; #endif /* @@ -66,6 +66,7 @@ struct rpcdata { #ifdef YP static int __yp_nomap = 0; +extern int _yp_check(char **); #endif /* YP */ static struct rpcent *interpret(); @@ -123,7 +124,7 @@ getrpcbynumber(number) no_yp: #endif /* YP */ setrpcent(0); - while (p = getrpcent()) { + while ((p = getrpcent())) { if (p->r_number == number) break; } @@ -139,7 +140,7 @@ getrpcbyname(name) char **rp; setrpcent(0); - while (rpc = getrpcent()) { + while ((rpc = getrpcent())) { if (strcmp(rpc->r_name, name) == 0) return (rpc); for (rp = rpc->r_aliases; *rp != NULL; rp++) { diff --git a/lib/libc/rpc/pmap_prot2.c b/lib/libc/rpc/pmap_prot2.c index 5e937ed7114e..2f2a9a0c5231 100644 --- a/lib/libc/rpc/pmap_prot2.c +++ b/lib/libc/rpc/pmap_prot2.c @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)pmap_prot2.c 1.3 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)pmap_prot2.c 2.1 88/07/29 4.0 RPCSRC";*/ -static char *rcsid = "$Id: pmap_prot2.c,v 1.1 1994/08/07 18:35:57 wollman Exp $"; +static char *rcsid = "$Id: pmap_prot2.c,v 1.2 1995/05/30 05:41:26 rgrimes Exp $"; #endif /* @@ -95,7 +95,7 @@ xdr_pmaplist(xdrs, rp) */ bool_t more_elements; register int freeing = (xdrs->x_op == XDR_FREE); - register struct pmaplist **next; + register struct pmaplist **next = NULL; while (TRUE) { more_elements = (bool_t)(*rp != NULL); diff --git a/lib/libc/rpc/rpc_dtablesize.c b/lib/libc/rpc/rpc_dtablesize.c index 6ca511df8994..330d0829540b 100644 --- a/lib/libc/rpc/rpc_dtablesize.c +++ b/lib/libc/rpc/rpc_dtablesize.c @@ -34,6 +34,7 @@ static char *rcsid = "rpc_dtablesize.c,v 1.1 1994/08/07 18:36:02 wollman Exp"; #endif #include +#include /* * Cache the result of getdtablesize(), so we don't have to do an @@ -50,7 +51,7 @@ static char *rcsid = "rpc_dtablesize.c,v 1.1 1994/08/07 18:36:02 wollman Exp"; * that. Clamping this function at 256 is a kludge, but it'll have to * do until select()'s descriptor table size can be adjusted dynamically. */ -_rpc_dtablesize() +int _rpc_dtablesize(void) { static int size; diff --git a/lib/libc/rpc/rpc_prot.c b/lib/libc/rpc/rpc_prot.c index 1693b6730c83..9f7d1c0ece28 100644 --- a/lib/libc/rpc/rpc_prot.c +++ b/lib/libc/rpc/rpc_prot.c @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)rpc_prot.c 1.36 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)rpc_prot.c 2.3 88/08/07 4.0 RPCSRC";*/ -static char *rcsid = "$Id: rpc_prot.c,v 1.1 1994/08/07 18:36:03 wollman Exp $"; +static char *rcsid = "$Id: rpc_prot.c,v 1.2 1995/05/30 05:41:31 rgrimes Exp $"; #endif /* @@ -106,6 +106,8 @@ xdr_accepted_reply(xdrs, ar) if (! xdr_u_long(xdrs, &(ar->ar_vers.low))) return (FALSE); return (xdr_u_long(xdrs, &(ar->ar_vers.high))); + default: + break; } return (TRUE); /* TRUE => open ended set of problems */ } @@ -236,6 +238,8 @@ rejected(rjct_stat, error) case AUTH_ERROR: error->re_status = RPC_AUTHERROR; return; + default: + break; } /* something's wrong, but we don't know what ... */ error->re_status = RPC_FAILED; @@ -287,5 +291,7 @@ _seterr_reply(msg, error) error->re_vers.low = msg->acpted_rply.ar_vers.low; error->re_vers.high = msg->acpted_rply.ar_vers.high; break; + default: + break; } } diff --git a/lib/libc/rpc/svc_simple.c b/lib/libc/rpc/svc_simple.c index 8bcc3061e8c5..f18b417ced11 100644 --- a/lib/libc/rpc/svc_simple.c +++ b/lib/libc/rpc/svc_simple.c @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)svc_simple.c 1.18 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)svc_simple.c 2.2 88/08/01 4.0 RPCSRC";*/ -static char *rcsid = "$Id: svc_simple.c,v 1.2 1995/05/30 05:41:37 rgrimes Exp $"; +static char *rcsid = "$Id: svc_simple.c,v 1.3 1995/10/22 14:51:37 phk Exp $"; #endif /* @@ -47,6 +47,8 @@ static char *rcsid = "$Id: svc_simple.c,v 1.2 1995/05/30 05:41:37 rgrimes Exp $" #include #include +bool_t pmap_unset(u_long, u_long); + static struct proglst { char *(*p_progname)(); int p_prognum; @@ -58,14 +60,15 @@ static void universal(); static SVCXPRT *transp; struct proglst *pl; -registerrpc(prognum, versnum, procnum, progname, inproc, outproc) +int registerrpc(prognum, versnum, procnum, progname, inproc, outproc) char *(*progname)(); + int prognum, versnum, procnum; xdrproc_t inproc, outproc; { if (procnum == NULLPROC) { (void) fprintf(stderr, - "can't reassign procedure number %d\n", NULLPROC); + "can't reassign procedure number %ld\n", NULLPROC); return (-1); } if (transp == 0) { diff --git a/lib/libc/rpc/svc_tcp.c b/lib/libc/rpc/svc_tcp.c index b408dec83739..2b941bad5c66 100644 --- a/lib/libc/rpc/svc_tcp.c +++ b/lib/libc/rpc/svc_tcp.c @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)svc_tcp.c 2.2 88/08/01 4.0 RPCSRC";*/ -static char *rcsid = "$Id: svc_tcp.c,v 1.4 1995/12/07 12:50:56 bde Exp $"; +static char *rcsid = "$Id: svc_tcp.c,v 1.5 1996/06/08 22:54:57 jraynard Exp $"; #endif /* @@ -82,9 +82,9 @@ static enum xprt_stat rendezvous_stat(); static struct xp_ops svctcp_rendezvous_op = { rendezvous_request, rendezvous_stat, - abort, - abort, - abort, + (bool_t (*)())abort, + (bool_t (*)())abort, + (bool_t (*)())abort, svctcp_destroy }; -- cgit v1.2.3