From 5835b1eec5a1f1e463c0762c510c6643fa2bff62 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Sun, 29 Jul 2007 17:20:10 +1000 Subject: [PATCH] Add -Wstrict-prototypes to compiler args, and fix warnings caused. --- configure.ac | 2 +- support/misc/from_local.c | 7 +++---- support/misc/tcpwrapper.c | 25 +++++++++---------------- support/nfs/fstab.c | 4 ++-- support/nfs/rpcmisc.c | 4 +++- support/nfs/wildmat.c | 8 ++------ utils/mount/mount.c | 2 +- utils/mount/nfsmount.c | 2 +- utils/mount/nfsumount.c | 2 +- utils/mount/nfsumount.h | 2 +- utils/showmount/showmount.c | 14 +++++--------- utils/statd/log.c | 2 +- utils/statd/log.h | 2 +- utils/statd/monitor.c | 2 +- utils/statd/sm-notify.c | 4 ++-- utils/statd/statd.c | 4 ++-- utils/statd/statd.h | 1 - 17 files changed, 36 insertions(+), 51 deletions(-) diff --git a/configure.ac b/configure.ac index 337becc..16d0da6 100644 --- a/configure.ac +++ b/configure.ac @@ -333,7 +333,7 @@ case $host in ARCHFLAGS="" ;; esac -my_am_cflags="-Wall $ARCHFLAGS -pipe" +my_am_cflags="-Wall -Wstrict-prototypes $ARCHFLAGS -pipe" AC_SUBST([AM_CPPFLAGS], ["-I\${top_srcdir}/support/include"]) AC_SUBST([AM_CFLAGS], ["$my_am_cflags"]) diff --git a/support/misc/from_local.c b/support/misc/from_local.c index f6f944c..d987207 100644 --- a/support/misc/from_local.c +++ b/support/misc/from_local.c @@ -71,7 +71,7 @@ static struct in_addr *addrs; /* grow_addrs - extend list of local interface addresses */ -static int grow_addrs() +static int grow_addrs(void) { struct in_addr *new_addrs; int new_num; @@ -99,7 +99,7 @@ static int grow_addrs() /* find_local - find all IP addresses for this host */ static int -find_local() +find_local(void) { struct ifconf ifc; struct ifreq ifreq; @@ -157,8 +157,7 @@ find_local() /* from_local - determine whether request comes from the local system */ int -from_local(addr) -struct sockaddr_in *addr; +from_local(struct sockaddr_in *addr) { int i; diff --git a/support/misc/tcpwrapper.c b/support/misc/tcpwrapper.c index ebe63e1..0cc9335 100644 --- a/support/misc/tcpwrapper.c +++ b/support/misc/tcpwrapper.c @@ -49,8 +49,9 @@ #include #endif -static void logit(); -static void toggle_verboselog(); +static void logit(int severity, struct sockaddr_in *addr, + u_long procnum, u_long prognum, char *text); +static void toggle_verboselog(int sig); int verboselog = 0; int allow_severity = LOG_INFO; int deny_severity = LOG_WARNING; @@ -139,7 +140,7 @@ struct sockaddr_in *addr; /* check_startup - additional startup code */ -void check_startup() +void check_startup(void) { /* @@ -194,11 +195,8 @@ u_long prog; /* check_privileged_port - additional checks for privileged-port updates */ int -check_privileged_port(addr, proc, prog, port) -struct sockaddr_in *addr; -u_long proc; -u_long prog; -u_long port; +check_privileged_port(struct sockaddr_in *addr, + u_long proc, u_long prog, u_long port) { #ifdef CHECK_PORT if (!legal_port(addr, port)) { @@ -211,8 +209,7 @@ u_long port; /* toggle_verboselog - toggle verbose logging flag */ -static void toggle_verboselog(sig) -int sig; +static void toggle_verboselog(int sig) { (void) signal(sig, toggle_verboselog); verboselog = !verboselog; @@ -220,12 +217,8 @@ int sig; /* logit - report events of interest via the syslog daemon */ -static void logit(severity, addr, procnum, prognum, text) -int severity; -struct sockaddr_in *addr; -u_long procnum; -u_long prognum; -char *text; +static void logit(int severity, struct sockaddr_in *addr, + u_long procnum, u_long prognum, char *text) { char *procname; char procbuf[16 + 4 * sizeof(u_long)]; diff --git a/support/nfs/fstab.c b/support/nfs/fstab.c index aee8e53..b4f8710 100644 --- a/support/nfs/fstab.c +++ b/support/nfs/fstab.c @@ -87,14 +87,14 @@ static void read_mounttable(void); static void read_fstab(void); static struct mntentchn * -mtab_head() { +mtab_head(void) { if (!got_mtab) read_mounttable(); return &mounttable; } static struct mntentchn * -fstab_head() +fstab_head(void) { if (!got_fstab) read_fstab(); diff --git a/support/nfs/rpcmisc.c b/support/nfs/rpcmisc.c index 22ea62c..fcc6433 100644 --- a/support/nfs/rpcmisc.c +++ b/support/nfs/rpcmisc.c @@ -47,7 +47,9 @@ int _rpcfdtype = 0; int _rpcsvcdirty = 0; void -rpc_init(char *name, int prog, int vers, void (*dispatch)(), int defport) +rpc_init(char *name, int prog, int vers, + void (*dispatch)(struct svc_req *, register SVCXPRT *), + int defport) { struct sockaddr_in saddr; SVCXPRT *transp; diff --git a/support/nfs/wildmat.c b/support/nfs/wildmat.c index ba53b3a..c5b4c78 100644 --- a/support/nfs/wildmat.c +++ b/support/nfs/wildmat.c @@ -59,9 +59,7 @@ ** Match text and p, return TRUE, FALSE, or ABORT. */ static int -DoMatch(text, p) - register char *text; - register char *p; +DoMatch(char *text, char *p) { register int last; register int matched; @@ -126,9 +124,7 @@ DoMatch(text, p) ** User-level routine. Returns TRUE or FALSE. */ int -wildmat(text, p) - char *text; - char *p; +wildmat(char *text, char *p) { #ifdef OPTIMIZE_JUST_STAR if (p[0] == '*' && p[1] == '\0') diff --git a/utils/mount/mount.c b/utils/mount/mount.c index 7a4912e..92ed2bc 100644 --- a/utils/mount/mount.c +++ b/utils/mount/mount.c @@ -267,7 +267,7 @@ fail_unlock: return result; } -void mount_usage() +void mount_usage(void) { printf("usage: %s remotetarget dir [-rvVwfnh] [-o nfsoptions]\n", progname); diff --git a/utils/mount/nfsmount.c b/utils/mount/nfsmount.c index 6949b50..b2b1992 100644 --- a/utils/mount/nfsmount.c +++ b/utils/mount/nfsmount.c @@ -93,7 +93,7 @@ extern char *progname; extern int verbose; extern int sloppy; -extern int linux_version_code(); +extern int linux_version_code(void); static inline enum clnt_stat nfs3_mount(CLIENT *clnt, mnt3arg_t *mnt3arg, mnt3res_t *mnt3res) diff --git a/utils/mount/nfsumount.c b/utils/mount/nfsumount.c index 303b485..aa68dee 100644 --- a/utils/mount/nfsumount.c +++ b/utils/mount/nfsumount.c @@ -236,7 +236,7 @@ static struct option umount_longopts[] = { NULL, 0, 0, 0 } }; -void umount_usage() +void umount_usage(void) { printf("usage: %s dir [-fvnrlh]\n", progname); printf("options:\n\t-f\t\tforce unmount\n"); diff --git a/utils/mount/nfsumount.h b/utils/mount/nfsumount.h index e37eaff..7548912 100644 --- a/utils/mount/nfsumount.h +++ b/utils/mount/nfsumount.h @@ -6,6 +6,6 @@ int nfsumount(int, char **); int nfs_call_umount(clnt_addr_t *, dirpath *); -void umount_usage(); +void umount_usage(void); #endif diff --git a/utils/showmount/showmount.c b/utils/showmount/showmount.c index f3ac671..4e10a29 100644 --- a/utils/showmount/showmount.c +++ b/utils/showmount/showmount.c @@ -62,16 +62,14 @@ static struct option longopts[] = #define MAXHOSTLEN 256 -int dump_cmp(p, q) -char **p; -char **q; +static int dump_cmp(const void *pv, const void *qv) { + const char **p = (const char **)pv; + const char **q = (const char **)qv; return strcmp(*p, *q); } -static void usage(fp, n) -FILE *fp; -int n; +static void usage(FILE *fp, int n) { fprintf(fp, "Usage: %s [-adehv]\n", program_name); fprintf(fp, " [--all] [--directories] [--exports]\n"); @@ -249,9 +247,7 @@ static unsigned short getport(struct sockaddr_in *addr, return htons(port); } -int main(argc, argv) -int argc; -char **argv; +int main(int argc, char **argv) { char hostname_buf[MAXHOSTLEN]; char *hostname; diff --git a/utils/statd/log.c b/utils/statd/log.c index bf2a926..a6ca996 100644 --- a/utils/statd/log.c +++ b/utils/statd/log.c @@ -33,7 +33,7 @@ static pid_t mypid; static int opt_debug = 0; /* Will be command-line option, eventually */ #endif -void log_init() +void log_init(void) { if (!(run_mode & MODE_LOG_STDERR)) openlog(name_p, LOG_PID | LOG_NDELAY, LOG_DAEMON); diff --git a/utils/statd/log.h b/utils/statd/log.h index 49f801a..fc55d3c 100644 --- a/utils/statd/log.h +++ b/utils/statd/log.h @@ -16,7 +16,7 @@ #include -void log_init(); +void log_init(void); void log_background(void); void log_enable(int facility); int log_enabled(int facility); diff --git a/utils/statd/monitor.c b/utils/statd/monitor.c index e40ff7d..eadc434 100644 --- a/utils/statd/monitor.c +++ b/utils/statd/monitor.c @@ -280,7 +280,7 @@ void load_state(void) b = strchr(buf, '\n'); if (b) *b = 0; sscanf(buf, "%x %x %x %x ", - &addr, &prog, &vers, &proc, myname); + &addr, &prog, &vers, &proc); b = buf+36; for (i=0; i