From: Stefano Brivio <sbrivio@redhat.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: netdev@vger.kernel.org, Phil Sutter <phil@nwl.cc>
Subject: [iproute PATCH v2 1/3] ss: Remove useless width specifier in process context print
Date: Tue, 31 Oct 2017 18:47:54 +0100 [thread overview]
Message-ID: <163c37d7aa5230112e1e332467090a92d5836332.1509471878.git.sbrivio@redhat.com> (raw)
In-Reply-To: <cover.1509471877.git.sbrivio@redhat.com>
In-Reply-To: <cover.1509471877.git.sbrivio@redhat.com>
Both local address and service, and remote address and service
fields are already printed out in netlink_show_one() before we
start printing process context, by calling sock_addr_print()
twice.
At this point, sock_addr_print() has already forced the remote
service field to be 'serv_width' wide -- that is, 'serv_width'
width has already been consumed, before we print process
context.
Hence, it makes no sense to force the display width of process
context to be 'serv_width' wide again: previous prints have
filled up the line already. Remove the width specifier and
prefix with a space instead, to keep this consistent with fields
which are displayed after the first output line.
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
misc/ss.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/misc/ss.c b/misc/ss.c
index dfb438f9162c..fa026eb0934b 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -3594,10 +3594,10 @@ static int netlink_show_one(struct filter *f,
getpidcon(pid, &pid_context);
if (pid_context != NULL) {
- printf("proc_ctx=%-*s ", serv_width, pid_context);
+ printf(" proc_ctx=%s", pid_context);
free(pid_context);
} else {
- printf("proc_ctx=%-*s ", serv_width, "unavailable");
+ printf(" proc_ctx=unavailable");
}
}
--
2.9.4
next prev parent reply other threads:[~2017-10-31 17:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-31 17:47 [iproute PATCH v2 0/3] ss: netlink_show_one() clean-up, minor output fix Stefano Brivio
2017-10-31 17:47 ` Stefano Brivio [this message]
2017-10-31 17:47 ` [iproute PATCH v2 2/3] ss: Streamline process context printing in netlink_show_one() Stefano Brivio
2017-10-31 17:47 ` [iproute PATCH v2 3/3] ss: Fix width calculations when Netid or State columns are missing Stefano Brivio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=163c37d7aa5230112e1e332467090a92d5836332.1509471878.git.sbrivio@redhat.com \
--to=sbrivio@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=phil@nwl.cc \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).