Date: Thu, 06 Aug 2026 15:01:35 +0000 From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 31765e232239 - stable/15 - rpcinfo: Fix residual warnings and bump WARNS Message-ID: <6a74a1cf.45cca.6a13f058@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=31765e2322398b83805b9f491ef0ff1f1939dc77 commit 31765e2322398b83805b9f491ef0ff1f1939dc77 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2026-07-27 19:00:49 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2026-08-06 13:24:42 +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 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 1d7354ae3722..5ad819d7d6ed 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; }; @@ -144,8 +144,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 @@ -584,7 +584,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 */ @@ -595,13 +595,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); @@ -628,7 +628,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; @@ -767,7 +767,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, @@ -975,7 +975,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; @@ -1651,7 +1652,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; @@ -1669,14 +1670,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?6a74a1cf.45cca.6a13f058>
