Clean up compilation warnings. Set WARNS=6 in Makefile.

PR:	71659
Submitted by:	Dan Lukes <dan obluda cz>
This commit is contained in:
Craig Rodrigues 2007-01-20 21:35:11 +00:00
parent 5cea64d54f
commit bec41fbe83
10 changed files with 35 additions and 89 deletions

View File

@ -8,7 +8,7 @@ MAN= mount_portalfs.8
MOUNT= ${.CURDIR}/../../sbin/mount
CFLAGS+=-I${MOUNT}
WARNS?= 0
WARNS?= 6
.PATH: ${MOUNT}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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. */

View File

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

View File

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