Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177591885
D47840.1794809414.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
4 KB
Referenced Files
None
Subscribers
None
D47840.1794809414.diff
View Options
diff --git a/usr.bin/sockstat/sockstat.c b/usr.bin/sockstat/sockstat.c
--- a/usr.bin/sockstat/sockstat.c
+++ b/usr.bin/sockstat/sockstat.c
@@ -1129,14 +1129,12 @@
switch (s->family) {
case AF_INET:
case AF_INET6:
- if (laddr != NULL) {
+ if (laddr != NULL)
pos += printaddr(&laddr->address);
- if (s->family == AF_INET6 && pos >= 58)
- pos += xprintf(" ");
- }
offset += opt_w ? 46 : 22;
- while (pos < offset)
+ do
pos += xprintf(" ");
+ while (pos < offset);
if (faddr != NULL)
pos += printaddr(&faddr->address);
offset += opt_w ? 46 : 22;
@@ -1208,8 +1206,9 @@
abort();
}
if (opt_f) {
- while (pos < offset)
+ do
pos += xprintf(" ");
+ while (pos < offset);
pos += xprintf("%d", s->fibnum);
offset += 7;
}
@@ -1220,12 +1219,14 @@
sp = RB_FIND(socks_t, &socks, &(struct sock)
{ .socket = s->splice_socket });
if (sp != NULL) {
- while (pos < offset)
+ do
pos += xprintf(" ");
+ while (pos < offset);
pos += printaddr(&sp->laddr->address);
} else {
- while (pos < offset)
+ do
pos += xprintf(" ");
+ while (pos < offset);
pos += xprintf("??");
offset += opt_w ? 46 : 22;
}
@@ -1235,8 +1236,9 @@
if (opt_i) {
if (s->proto == IPPROTO_TCP ||
s->proto == IPPROTO_UDP) {
- while (pos < offset)
+ do
pos += xprintf(" ");
+ while (pos < offset);
pos += xprintf("%" PRIu64, s->inp_gencnt);
}
offset += 9;
@@ -1250,8 +1252,9 @@
(s->proto == IPPROTO_TCP &&
s->state != TCPS_CLOSED &&
s->state != TCPS_LISTEN))) {
- while (pos < offset)
+ do
pos += xprintf(" ");
+ while (pos < offset);
pos += xprintf("%u",
ntohs(faddr->encaps_port));
}
@@ -1263,8 +1266,9 @@
s->state != SCTP_CLOSED &&
s->state != SCTP_BOUND &&
s->state != SCTP_LISTEN) {
- while (pos < offset)
+ do
pos += xprintf(" ");
+ while (pos < offset);
pos += xprintf("%s",
sctp_path_state(faddr->state));
}
@@ -1274,8 +1278,9 @@
if (opt_s) {
if (s->proto == IPPROTO_SCTP ||
s->proto == IPPROTO_TCP) {
- while (pos < offset)
+ do
pos += xprintf(" ");
+ while (pos < offset);
switch (s->proto) {
case IPPROTO_SCTP:
pos += xprintf("%s",
@@ -1295,8 +1300,9 @@
}
if (opt_S) {
if (s->proto == IPPROTO_TCP) {
- while (pos < offset)
+ do
pos += xprintf(" ");
+ while (pos < offset);
pos += xprintf("%.*s",
TCP_FUNCTION_NAME_LEN_MAX,
s->stack);
@@ -1305,8 +1311,9 @@
}
if (opt_C) {
if (s->proto == IPPROTO_TCP) {
- while (pos < offset)
+ do
pos += xprintf(" ");
+ while (pos < offset);
xprintf("%.*s", TCP_CA_NAME_MAX, s->cc);
}
offset += TCP_CA_NAME_MAX + 1;
@@ -1371,18 +1378,21 @@
pos = 0;
if (opt_n ||
(pwd = cap_getpwuid(cappwd, xf->xf_uid)) == NULL)
- pos += xprintf("%lu ", (u_long)xf->xf_uid);
+ pos += xprintf("%lu", (u_long)xf->xf_uid);
else
- pos += xprintf("%s ", pwd->pw_name);
- while (pos < 9)
+ pos += xprintf("%s", pwd->pw_name);
+ do
pos += xprintf(" ");
+ while (pos < 9);
pos += xprintf("%.10s", getprocname(xf->xf_pid));
- while (pos < 20)
+ do
pos += xprintf(" ");
- pos += xprintf("%5lu ", (u_long)xf->xf_pid);
- while (pos < 26)
+ while (pos < 20);
+ pos += xprintf("%5lu", (u_long)xf->xf_pid);
+ do
pos += xprintf(" ");
- pos += xprintf("%-3d ", xf->xf_fd);
+ while (pos < 26);
+ pos += xprintf("%-3d", xf->xf_fd);
displaysock(s, pos);
}
}
@@ -1391,7 +1401,7 @@
SLIST_FOREACH(s, &nosocks, socket_list) {
if (!check_ports(s))
continue;
- pos = xprintf("%-8s %-10s %-5s %-2s ",
+ pos = xprintf("%-8s %-10s %-5s %-3s",
"?", "?", "?", "?");
displaysock(s, pos);
}
@@ -1400,7 +1410,7 @@
continue;
if (!check_ports(s))
continue;
- pos = xprintf("%-8s %-10s %-5s %-2s ",
+ pos = xprintf("%-8s %-10s %-5s %-3s",
"?", "?", "?", "?");
displaysock(s, pos);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 16, 6:10 AM (8 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41763887
Default Alt Text
D47840.1794809414.diff (4 KB)
Attached To
Mode
D47840: sockstat: Ensure that there is always a space between columns
Attached
Detach File
Event Timeline