git: bdc45e43f469 - stable/14 - rpcinfo: Fix residual warnings and bump WARNS
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 05 Aug 2026 15:16:17 UTC
The branch stable/14 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=bdc45e43f469459fe2a72ba7025dc1a39b8c769c
commit bdc45e43f469459fe2a72ba7025dc1a39b8c769c
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-07-27 19:00:49 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-08-05 15:15:14 +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
(cherry picked from commit 95a3301ce144aecce5de88fb4e2905c440533fb8)
---
usr.bin/rpcinfo/Makefile | 2 --
usr.bin/rpcinfo/rpcinfo.c | 31 ++++++++++++++++---------------
2 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/usr.bin/rpcinfo/Makefile b/usr.bin/rpcinfo/Makefile
index d1e680338849..332ef7a96861 100644
--- a/usr.bin/rpcinfo/Makefile
+++ b/usr.bin/rpcinfo/Makefile
@@ -6,6 +6,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 a153b90d39c9..42bf61133df0 100644
--- a/usr.bin/rpcinfo/rpcinfo.c
+++ b/usr.bin/rpcinfo/rpcinfo.c
@@ -87,7 +87,7 @@ static char sccsid[] = "@(#)rpcinfo.c 1.16 89/04/05 Copyr 1986 Sun Micro";
#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.
@@ -111,7 +111,7 @@ struct netidlist {
};
struct verslist {
- int vers;
+ rpcvers_t vers;
struct verslist *next;
};
@@ -152,8 +152,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
@@ -592,7 +592,7 @@ get_inet_address(struct sockaddr_in *addr, char *host)
/*ARGSUSED*/
static bool_t
-reply_proc(void *res, struct netbuf *who, struct netconfig *nconf)
+reply_proc(void *res __unused, struct netbuf *who, struct netconfig *nconf)
/* void *res; Nothing comes back */
/* struct netbuf *who; Who sent us the reply */
/* struct netconfig *nconf; On which transport the reply came */
@@ -603,13 +603,13 @@ reply_proc(void *res, struct netbuf *who, struct netconfig *nconf)
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);
@@ -636,7 +636,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;
@@ -775,7 +775,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,
@@ -983,7 +983,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;
@@ -1659,7 +1660,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;
@@ -1677,14 +1678,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]);
}