svn commit: r352572 - head/usr.sbin/rpc.statd

Hiroki Sato hrs at FreeBSD.org
Sat Sep 21 12:33:42 UTC 2019


Author: hrs
Date: Sat Sep 21 12:33:41 2019
New Revision: 352572
URL: https://svnweb.freebsd.org/changeset/base/352572

Log:
  Fix warnings and set WARNS=6.

Modified:
  head/usr.sbin/rpc.statd/Makefile
  head/usr.sbin/rpc.statd/file.c
  head/usr.sbin/rpc.statd/statd.c

Modified: head/usr.sbin/rpc.statd/Makefile
==============================================================================
--- head/usr.sbin/rpc.statd/Makefile	Sat Sep 21 01:39:49 2019	(r352571)
+++ head/usr.sbin/rpc.statd/Makefile	Sat Sep 21 12:33:41 2019	(r352572)
@@ -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

Modified: head/usr.sbin/rpc.statd/file.c
==============================================================================
--- head/usr.sbin/rpc.statd/file.c	Sat Sep 21 01:39:49 2019	(r352571)
+++ head/usr.sbin/rpc.statd/file.c	Sat Sep 21 12:33:41 2019	(r352572)
@@ -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;

Modified: head/usr.sbin/rpc.statd/statd.c
==============================================================================
--- head/usr.sbin/rpc.statd/statd.c	Sat Sep 21 01:39:49 2019	(r352571)
+++ head/usr.sbin/rpc.statd/statd.c	Sat Sep 21 12:33:41 2019	(r352572)
@@ -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;


More information about the svn-src-head mailing list