Fix warnings and set WARNS=6.

This commit is contained in:
Hiroki Sato 2019-09-21 12:33:41 +00:00
parent 685e059d94
commit aec74e0ce0
3 changed files with 11 additions and 12 deletions

View File

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

View File

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

View File

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