git: f89f7e58ba1d - main - sockstat: improve formataddr() according to style(9)
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 16 Jan 2026 19:37:00 UTC
The branch main has been updated by michaelo:
URL: https://cgit.FreeBSD.org/src/commit/?id=f89f7e58ba1d54c6a683e3cc899938895496c088
commit f89f7e58ba1d54c6a683e3cc899938895496c088
Author: Michael Osipov <michaelo@FreeBSD.org>
AuthorDate: 2025-12-29 21:31:49 +0000
Commit: Michael Osipov <michaelo@FreeBSD.org>
CommitDate: 2026-01-16 19:36:46 +0000
sockstat: improve formataddr() according to style(9)
Reviewed by: des
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D54412
---
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 1f174d827e1a..32b1ac1a8d20 100644
--- a/usr.bin/sockstat/main.c
+++ b/usr.bin/sockstat/main.c
@@ -926,8 +926,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:
@@ -960,11 +960,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 *