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.
This commit is contained in:
James Raynard 1996-06-10 20:13:09 +00:00
parent 1c346c7092
commit f12d1a5dd0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=16283
9 changed files with 37 additions and 21 deletions

View File

@ -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 <rpc/auth.h>
#include <rpc/auth_unix.h>
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));
}

View File

@ -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);

View File

@ -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;
{

View File

@ -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++) {

View File

@ -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);

View File

@ -34,6 +34,7 @@ static char *rcsid = "rpc_dtablesize.c,v 1.1 1994/08/07 18:36:02 wollman Exp";
#endif
#include <sys/types.h>
#include <unistd.h>
/*
* 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;

View File

@ -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;
}
}

View File

@ -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 <sys/socket.h>
#include <netdb.h>
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) {

View File

@ -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
};