git: f51bc79200fe - stable/15 - sockstat: improve formataddr() according to style(9)
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 19 Jan 2026 22:08:49 UTC
The branch stable/15 has been updated by michaelo:
URL: https://cgit.FreeBSD.org/src/commit/?id=f51bc79200fea740de3beb3d7dbdec1537a2839b
commit f51bc79200fea740de3beb3d7dbdec1537a2839b
Author: Michael Osipov <michaelo@FreeBSD.org>
AuthorDate: 2025-12-29 21:31:49 +0000
Commit: Michael Osipov <michaelo@FreeBSD.org>
CommitDate: 2026-01-19 22:08:30 +0000
sockstat: improve formataddr() according to style(9)
Reviewed by: des
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D54412
(cherry picked from commit f89f7e58ba1d54c6a683e3cc899938895496c088)
---
usr.bin/sockstat/main.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/usr.bin/sockstat/main.c b/usr.bin/sockstat/main.c
index 07663e54534d..75c4b2aad223 100644
--- a/usr.bin/sockstat/main.c
+++ b/usr.bin/sockstat/main.c
@@ -895,8 +895,8 @@ static int
formataddr(struct sockaddr_storage *ss, char *buf, size_t bufsize)
{
struct sockaddr_un *sun;
- char addrstr[NI_MAXHOST] = { '\0', '\0' };
int error, off, port = 0;
+ char addrstr[NI_MAXHOST] = "";
switch (ss->ss_family) {
case AF_INET:
@@ -929,11 +929,11 @@ formataddr(struct sockaddr_storage *ss, char *buf, size_t bufsize)
if (is_xo_style_encoding) {
xo_emit("{:address/%s}", addrstr);
xo_emit("{:port/%d}", port);
- return 0;
+ return (0);
}
if (port == 0)
- return snprintf(buf, bufsize, "%s:*", addrstr);
- return snprintf(buf, bufsize, "%s:%d", addrstr, port);
+ return (snprintf(buf, bufsize, "%s:*", addrstr));
+ return (snprintf(buf, bufsize, "%s:%d", addrstr, port));
}
static const char *