From fa5751c90d82c32b4cb81bb161088ee3ea940e8c Mon Sep 17 00:00:00 2001 From: hrs Date: Sat, 21 Sep 2019 12:33:41 +0000 Subject: [PATCH] Fix warnings and set WARNS=6. --- usr.sbin/rpc.statd/Makefile | 4 +--- usr.sbin/rpc.statd/file.c | 4 ++-- usr.sbin/rpc.statd/statd.c | 15 ++++++++------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/usr.sbin/rpc.statd/Makefile b/usr.sbin/rpc.statd/Makefile index 4cbbb4639698..0187d422ebaf 100644 --- a/usr.sbin/rpc.statd/Makefile +++ b/usr.sbin/rpc.statd/Makefile @@ -4,9 +4,7 @@ PROG= rpc.statd MAN= rpc.statd.8 SRCS= file.c sm_inter_svc.c sm_inter.h statd.c procs.c -CFLAGS+= -I. -WARNS?= 2 - +CFLAGS+= -I${.OBJDIR} LIBADD= rpcsvc CLEANFILES= sm_inter_svc.c sm_inter.h diff --git a/usr.sbin/rpc.statd/file.c b/usr.sbin/rpc.statd/file.c index ed5d00cc808c..d4fd3eda8882 100644 --- a/usr.sbin/rpc.statd/file.c +++ b/usr.sbin/rpc.statd/file.c @@ -201,8 +201,8 @@ void init_file(const char *filename) /* defective, re-create from scratch. */ if (!new_file) { - if ((status_file_len < HEADER_LEN) || (status_file_len - < (HEADER_LEN + sizeof(HostInfo) * status_info->noOfHosts)) ) + if ((status_file_len < (off_t)HEADER_LEN) || (status_file_len + < (off_t)(HEADER_LEN + sizeof(HostInfo) * status_info->noOfHosts)) ) { warnx("status file is corrupt"); new_file = TRUE; diff --git a/usr.sbin/rpc.statd/statd.c b/usr.sbin/rpc.statd/statd.c index b789f8149106..50368824756f 100644 --- a/usr.sbin/rpc.statd/statd.c +++ b/usr.sbin/rpc.statd/statd.c @@ -62,9 +62,9 @@ __FBSDID("$FreeBSD$"); int debug = 0; /* Controls syslog() calls for debug messages */ -char **hosts, *svcport_str = NULL; -int nhosts = 0; -int xcreated = 0; +static char **hosts, *svcport_str = NULL; +static int nhosts = 0; +static int xcreated = 0; static int mallocd_svcport = 0; static int *sock_fd; static int sock_fdcnt; @@ -86,7 +86,8 @@ main(int argc, char **argv) void *nc_handle; in_port_t svcport; int ch, i, s; - char *endptr, **hosts_bak; + char *endptr; + char **hosts_bak; int have_v6 = 1; int maxrec = RPC_MAXDATASIZE; int attempt_cnt, port_len, port_pos, ret; @@ -156,7 +157,7 @@ main(int argc, char **argv) if (hosts == NULL) out_of_mem(); - hosts[0] = "*"; + hosts[0] = strdup("*"); nhosts = 1; } else { hosts_bak = hosts; @@ -172,7 +173,7 @@ main(int argc, char **argv) hosts = hosts_bak; nhosts += 2; - hosts[nhosts - 2] = "::1"; + hosts[nhosts - 2] = strdup("::1"); } else { hosts_bak = realloc(hosts, (nhosts + 1) * sizeof(char *)); if (hosts_bak == NULL) { @@ -186,7 +187,7 @@ main(int argc, char **argv) hosts = hosts_bak; } } - hosts[nhosts - 1] = "127.0.0.1"; + hosts[nhosts - 1] = strdup("127.0.0.1"); } attempt_cnt = 1;