Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Jul 2026 23:11:02 +0000
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 95a3301ce144 - main - rpcinfo: Fix residual warnings and bump WARNS
Message-ID:  <6a67e586.3260d.1cfd298@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=95a3301ce144aecce5de88fb4e2905c440533fb8

commit 95a3301ce144aecce5de88fb4e2905c440533fb8
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-07-27 19:00:49 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-07-27 23:03:16 +0000

    rpcinfo: Fix residual warnings and bump WARNS
    
    Reviewed by:    emaste
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D58442
---
 usr.bin/rpcinfo/Makefile  |  2 --
 usr.bin/rpcinfo/rpcinfo.c | 29 +++++++++++++++--------------
 2 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/usr.bin/rpcinfo/Makefile b/usr.bin/rpcinfo/Makefile
index a55485e4f718..ffe593401397 100644
--- a/usr.bin/rpcinfo/Makefile
+++ b/usr.bin/rpcinfo/Makefile
@@ -4,6 +4,4 @@ MAN=	rpcinfo.8
 
 CFLAGS+= -DPORTMAP
 
-WARNS?=	2
-
 .include <bsd.prog.mk>
diff --git a/usr.bin/rpcinfo/rpcinfo.c b/usr.bin/rpcinfo/rpcinfo.c
index 70d632fb9227..15c4ca4721b1 100644
--- a/usr.bin/rpcinfo/rpcinfo.c
+++ b/usr.bin/rpcinfo/rpcinfo.c
@@ -79,7 +79,7 @@
 #define MAXHOSTLEN 256
 #define	MIN_VERS	((u_long) 0)
 #define	MAX_VERS	((u_long) 4294967295UL)
-#define	UNKNOWN		"unknown"
+static char unknown[] = "unknown";
 
 /*
  * Functions to be performed.
@@ -103,7 +103,7 @@ struct netidlist {
 };
 
 struct verslist {
-	int vers;
+	rpcvers_t vers;
 	struct verslist *next;
 };
 
@@ -145,8 +145,8 @@ static void	print_getaddrstat(int, rpcb_stat *);
 static void	usage(void);
 static u_long	getprognum(char *);
 static u_long	getvers(char *);
-static char	*spaces(int);
-static bool_t	add_version(struct rpcbdump_short *, u_long);
+static const char *spaces(size_t);
+static bool_t	add_version(struct rpcbdump_short *, rpcvers_t);
 static bool_t	add_netid(struct rpcbdump_short *, char *);
 
 int
@@ -597,13 +597,13 @@ reply_proc(char *res __unused, const struct netbuf *who,
 	struct sockaddr *sa = (struct sockaddr *)who->buf;
 
 	if (getnameinfo(sa, sa->sa_len, hostbuf, NI_MAXHOST, NULL, 0, 0)) {
-		hostname = UNKNOWN;
+		hostname = unknown;
 	} else {
 		hostname = hostbuf;
 	}
 	uaddr = taddr2uaddr(nconf, who);
 	if (uaddr == NULL) {
-		printf("%s\t%s\n", UNKNOWN, hostname);
+		printf("%s\t%s\n", unknown, hostname);
 	} else {
 		printf("%s\t%s\n", uaddr, hostname);
 		free((char *)uaddr);
@@ -630,7 +630,7 @@ brdcst(int argc, char **argv)
 }
 
 static bool_t
-add_version(struct rpcbdump_short *rs, u_long vers)
+add_version(struct rpcbdump_short *rs, rpcvers_t vers)
 {
 	struct verslist *vl;
 
@@ -769,7 +769,7 @@ rpcbdump(int dumptype, char *netid, int argc, char **argv)
 			    }
 			    if (list->rpcb_map.r_netid == NULL)
 				    goto error;
-			    list->rpcb_map.r_owner = UNKNOWN;
+			    list->rpcb_map.r_owner = unknown;
 			    low = pmaphead->pml_map.pm_port & 0xff;
 			    high = (pmaphead->pml_map.pm_port >> 8) & 0xff;
 			    (void)asprintf(&list->rpcb_map.r_addr,
@@ -977,7 +977,8 @@ rpcbgetstat(int argc, char **argv)
 	struct timeval minutetimeout;
 	register CLIENT *client;
 	char *host;
-	int i, j;
+	unsigned int i;
+	int j;
 	rpcbs_addrlist *pa;
 	rpcbs_rmtcalllist *pr;
 	int cnt, flen;
@@ -1653,7 +1654,7 @@ print_rmtcallstat(int rtype, rpcb_stat *infp)
 }
 
 static void
-print_getaddrstat(int rtype, rpcb_stat *infp)
+print_getaddrstat(int rtype __unused, rpcb_stat *infp)
 {
 	rpcbs_addrlist_ptr al;
 	register struct rpcent *rpc;
@@ -1671,14 +1672,14 @@ print_getaddrstat(int rtype, rpcb_stat *infp)
 	}
 }
 
-static char *
-spaces(int howmany)
+static const char *
+spaces(size_t howmany)
 {
 	static char space_array[] =		/* 64 spaces */
 	"                                                                ";
 
-	if (howmany <= 0 || howmany > sizeof (space_array)) {
+	if (howmany >= sizeof(space_array)) {
 		return ("");
 	}
-	return (&space_array[sizeof (space_array) - howmany - 1]);
+	return (&space_array[sizeof(space_array) - howmany - 1]);
 }


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a67e586.3260d.1cfd298>