From 1308f85b86e1b4e055836985619257b1bbdf2987 Mon Sep 17 00:00:00 2001 From: rodrigc Date: Sat, 20 Jan 2007 21:35:11 +0000 Subject: Clean up compilation warnings. Set WARNS=6 in Makefile. PR: 71659 Submitted by: Dan Lukes --- usr.sbin/mount_portalfs/Makefile | 2 +- usr.sbin/mount_portalfs/activate.c | 25 ++++++---------------- usr.sbin/mount_portalfs/conf.c | 36 +++++++++----------------------- usr.sbin/mount_portalfs/mount_portalfs.c | 13 ++++-------- usr.sbin/mount_portalfs/portald.h | 2 +- usr.sbin/mount_portalfs/pt_exec.c | 8 ++----- usr.sbin/mount_portalfs/pt_file.c | 8 ++----- usr.sbin/mount_portalfs/pt_pipe.c | 8 ++----- usr.sbin/mount_portalfs/pt_tcp.c | 10 +++------ usr.sbin/mount_portalfs/pt_tcplisten.c | 12 ++++------- 10 files changed, 35 insertions(+), 89 deletions(-) (limited to 'usr.sbin/mount_portalfs') diff --git a/usr.sbin/mount_portalfs/Makefile b/usr.sbin/mount_portalfs/Makefile index 610ac23..b7027e7 100644 --- a/usr.sbin/mount_portalfs/Makefile +++ b/usr.sbin/mount_portalfs/Makefile @@ -8,7 +8,7 @@ MAN= mount_portalfs.8 MOUNT= ${.CURDIR}/../../sbin/mount CFLAGS+=-I${MOUNT} -WARNS?= 0 +WARNS?= 6 .PATH: ${MOUNT} diff --git a/usr.sbin/mount_portalfs/activate.c b/usr.sbin/mount_portalfs/activate.c index 2d00178..7d35d48 100644 --- a/usr.sbin/mount_portalfs/activate.c +++ b/usr.sbin/mount_portalfs/activate.c @@ -51,12 +51,8 @@ __FBSDID("$FreeBSD$"); * Scan the providers list and call the * appropriate function. */ -static int activate_argv(pcr, key, v, so, fdp) -struct portal_cred *pcr; -char *key; -char **v; -int so; -int *fdp; +static int activate_argv(struct portal_cred *pcr, char *key, char **v, int so, + int *fdp) { provider *pr; @@ -67,11 +63,7 @@ int *fdp; return (ENOENT); } -static int get_request(so, pcr, key, klen) -int so; -struct portal_cred *pcr; -char *key; -int klen; +static int get_request(int so, struct portal_cred *pcr, char *key, int klen) { struct iovec iov[2]; struct msghdr msg; @@ -90,7 +82,7 @@ int klen; if (n < 0) return (errno); - if (n <= sizeof(*pcr)) + if (n <= (int)sizeof(*pcr)) return (EINVAL); n -= sizeof(*pcr); @@ -99,10 +91,7 @@ int klen; return (0); } -static void send_reply(so, fd, error) -int so; -int fd; -int error; +static void send_reply(int so, int fd, int error) { int n; struct iovec iov; @@ -158,9 +147,7 @@ int error; (void) close(fd); } -void activate(q, so) -qelem *q; -int so; +void activate(qelem *q, int so) { struct portal_cred pcred; char key[MAXPATHLEN+1]; diff --git a/usr.sbin/mount_portalfs/conf.c b/usr.sbin/mount_portalfs/conf.c index 5e0db79..f6b34bd 100644 --- a/usr.sbin/mount_portalfs/conf.c +++ b/usr.sbin/mount_portalfs/conf.c @@ -70,8 +70,7 @@ static path *curp; /* XXX for regerror */ * Add an element to a 2-way list, * just after (pred) */ -static void ins_que(elem, pred) -qelem *elem, *pred; +static void ins_que(qelem *elem, qelem *pred) { qelem *p = pred->q_forw; elem->q_back = pred; @@ -83,8 +82,7 @@ qelem *elem, *pred; /* * Remove an element from a 2-way list */ -static void rem_que(elem) -qelem *elem; +static void rem_que(qelem *elem) { qelem *p = elem->q_forw; qelem *p2 = elem->q_back; @@ -95,8 +93,7 @@ qelem *elem; /* * Error checking malloc */ -static void *xmalloc(siz) -unsigned siz; +static void *xmalloc(unsigned siz) { void *p = malloc(siz); if (p) @@ -112,9 +109,7 @@ unsigned siz; * not found then the path is added to the end of the list * and 1 is returned. */ -static int pinsert(p0, q0) -path *p0; -qelem *q0; +static int pinsert(path *p0, qelem *q0) { qelem *q; @@ -131,9 +126,7 @@ qelem *q0; } -static path *palloc(cline, lno) -char *cline; -int lno; +static path *palloc(char *cline, int lno) { int c; char *s; @@ -219,8 +212,7 @@ int lno; /* * Free a path structure */ -static void pfree(p) -path *p; +static void pfree(path *p) { free(p->p_args); if (p->p_rxvalid) { @@ -234,9 +226,7 @@ path *p; * Discard all currently held path structures on q0. * and add all the ones on xq. */ -static void preplace(q0, xq) -qelem *q0; -qelem *xq; +static void preplace(qelem *q0, qelem *xq) { /* * While the list is not empty, @@ -259,9 +249,7 @@ qelem *xq; * Read the lines from the configuration file and * add them to the list of paths. */ -static void readfp(q0, fp) -qelem *q0; -FILE *fp; +static void readfp(qelem *q0, FILE *fp) { char cline[LINE_MAX]; int nread = 0; @@ -296,9 +284,7 @@ FILE *fp; * the existing path list with the new version. * If the file is not readable, then no changes take place */ -void conf_read(q, conf) -qelem *q; -char *conf; +void conf_read(qelem *q, char *conf) { FILE *fp = fopen(conf, "r"); if (fp) { @@ -312,9 +298,7 @@ char *conf; } -char **conf_match(q0, key) -qelem *q0; -char *key; +char **conf_match(qelem *q0, char *key) { qelem *q; diff --git a/usr.sbin/mount_portalfs/mount_portalfs.c b/usr.sbin/mount_portalfs/mount_portalfs.c index 376e827..9a8c49c 100644 --- a/usr.sbin/mount_portalfs/mount_portalfs.c +++ b/usr.sbin/mount_portalfs/mount_portalfs.c @@ -65,21 +65,19 @@ __FBSDID("$FreeBSD$"); struct mntopt mopts[] = { MOPT_STDOPTS, - { NULL } + MOPT_END }; static void usage(void) __dead2; static sig_atomic_t readcf; /* Set when SIGHUP received */ -static void sighup(sig) -int sig; +static void sighup(int sig __unused) { readcf ++; } -static void sigchld(sig) -int sig; +static void sigchld(int sig __unused) { pid_t pid; @@ -93,9 +91,7 @@ int sig; } int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { struct portal_args args; struct sockaddr_un un; @@ -206,7 +202,6 @@ main(argc, argv) int so2; pid_t pid; fd_set fdset; - int rc; /* * Check whether we need to re-read the configuration file diff --git a/usr.sbin/mount_portalfs/portald.h b/usr.sbin/mount_portalfs/portald.h index ff4c3fd..5bd63ed 100644 --- a/usr.sbin/mount_portalfs/portald.h +++ b/usr.sbin/mount_portalfs/portald.h @@ -54,7 +54,7 @@ struct qelem { typedef struct provider provider; struct provider { - char *pr_match; + const char *pr_match; int (*pr_func)(struct portal_cred *, char *key, char **v, int so, int *fdp); }; diff --git a/usr.sbin/mount_portalfs/pt_exec.c b/usr.sbin/mount_portalfs/pt_exec.c index f679b42..86a47e9 100644 --- a/usr.sbin/mount_portalfs/pt_exec.c +++ b/usr.sbin/mount_portalfs/pt_exec.c @@ -42,12 +42,8 @@ __FBSDID("$FreeBSD$"); #include "portald.h" -int portal_exec(pcr, key, v, so, fdp) -struct portal_cred *pcr; -char *key; -char **v; -int so; -int *fdp; +int portal_exec(struct portal_cred *pcr __unused, char *key __unused, + char **v __unused, int so __unused, int *fdp __unused) { return (ENOEXEC); } diff --git a/usr.sbin/mount_portalfs/pt_file.c b/usr.sbin/mount_portalfs/pt_file.c index 868d6dd..270f812 100644 --- a/usr.sbin/mount_portalfs/pt_file.c +++ b/usr.sbin/mount_portalfs/pt_file.c @@ -46,12 +46,8 @@ __FBSDID("$FreeBSD$"); #include "portald.h" -int portal_file(pcr, key, v, so, fdp) -struct portal_cred *pcr; -char *key; -char **v; -int so; -int *fdp; +int portal_file(struct portal_cred *pcr, + char *key, char **v, int so __unused, int *fdp) { int fd; char pbuf[MAXPATHLEN]; diff --git a/usr.sbin/mount_portalfs/pt_pipe.c b/usr.sbin/mount_portalfs/pt_pipe.c index 285f193..fd54b7e 100644 --- a/usr.sbin/mount_portalfs/pt_pipe.c +++ b/usr.sbin/mount_portalfs/pt_pipe.c @@ -48,12 +48,8 @@ __FBSDID("$FreeBSD$"); static int errlog(void); static int parse_argv(char *args, char **argv); -int portal_pipe(pcr, key, v, so, fdp) -struct portal_cred *pcr; -char *key; -char **v; -int so; -int *fdp; +int portal_pipe(struct portal_cred *pcr, char *key, char **v, + int kso __unused, int *fdp) { int fd[2]; /* Pipe endpoints. */ int caller_end; /* The pipe end we will use. */ diff --git a/usr.sbin/mount_portalfs/pt_tcp.c b/usr.sbin/mount_portalfs/pt_tcp.c index 4438a0b..d9a2a1e 100644 --- a/usr.sbin/mount_portalfs/pt_tcp.c +++ b/usr.sbin/mount_portalfs/pt_tcp.c @@ -57,12 +57,8 @@ __FBSDID("$FreeBSD$"); * Some trailing suffix values have special meanings. * An unrecognized suffix is an error. */ -int portal_tcp(pcr, key, v, kso, fdp) - struct portal_cred *pcr; - char *key; - char **v; - int kso; - int *fdp; +int portal_tcp(struct portal_cred *pcr, char *key, char **v, + int kso __unused, int *fdp) { char host[MAXHOSTNAMELEN]; char port[MAXHOSTNAMELEN]; @@ -78,7 +74,7 @@ int portal_tcp(pcr, key, v, kso, fdp) struct sockaddr_in sain; q = strchr(p, '/'); - if (q == 0 || q - p >= sizeof(host)) + if (q == 0 || q - p >= (int)sizeof(host)) return (EINVAL); *q = '\0'; strcpy(host, p); diff --git a/usr.sbin/mount_portalfs/pt_tcplisten.c b/usr.sbin/mount_portalfs/pt_tcplisten.c index 4463e40..b7febb1 100644 --- a/usr.sbin/mount_portalfs/pt_tcplisten.c +++ b/usr.sbin/mount_portalfs/pt_tcplisten.c @@ -67,12 +67,8 @@ __FBSDID("$FreeBSD$"); * may cause remote auth (identd) to return unexpected results. * */ -int portal_tcplisten(pcr, key, v, kso, fdp) - struct portal_cred *pcr; - char *key; - char **v; - int kso; - int *fdp; +int portal_tcplisten(struct portal_cred *pcr, char *key, char **v, + int kso __unused, int *fdp) { char host[MAXHOSTNAMELEN]; char port[MAXHOSTNAMELEN]; @@ -80,7 +76,7 @@ int portal_tcplisten(pcr, key, v, kso, fdp) char *q; struct hostent *hp; struct servent *sp; - struct in_addr **ipp; + struct in_addr **ipp = NULL; struct in_addr *ip[2]; struct in_addr ina; u_short s_port; @@ -88,7 +84,7 @@ int portal_tcplisten(pcr, key, v, kso, fdp) struct sockaddr_in sain; q = strchr(p, '/'); - if (q == 0 || q - p >= sizeof(host)) + if (q == 0 || q - p >= (int)sizeof(host)) return (EINVAL); *q = '\0'; snprintf(host, sizeof(host), "%s", p); -- cgit v1.1