aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/rpc.statd
diff options
context:
space:
mode:
authorHiroki Sato <hrs@FreeBSD.org>2019-09-21 12:33:41 +0000
committerHiroki Sato <hrs@FreeBSD.org>2019-09-21 12:33:41 +0000
commitaec74e0ce02ed907f703ecbc225bf714a146bdc9 (patch)
treeeb1593c1a4f594349b0e9a6ba4aad3b01b688005 /usr.sbin/rpc.statd
parent685e059d948f77d33a05d7eaece0fe155ba897f4 (diff)
Notes
Diffstat (limited to 'usr.sbin/rpc.statd')
-rw-r--r--usr.sbin/rpc.statd/Makefile4
-rw-r--r--usr.sbin/rpc.statd/file.c4
-rw-r--r--usr.sbin/rpc.statd/statd.c15
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;