From: Brian Vazquez <brianvv@google.com>
To: Brian Vazquez <brianvv.kernel@gmail.com>,
David Ahern <dsahern@gmail.com>,
Stephen Hemminger <stephen@networkplumber.org>
Cc: Mahesh Bandewar <maheshb@google.com>,
Maciej Zenczykowski <maze@google.com>,
netdev@vger.kernel.org, Brian Vazquez <brianvv@google.com>,
Hritik Vijay <hritikxx8@gmail.com>
Subject: [PATCH iproute2] ss: fix end-of-line printing in misc/ss.c
Date: Tue, 26 Nov 2019 21:21:18 -0800 [thread overview]
Message-ID: <20191127052118.163594-1-brianvv@google.com> (raw)
Before commit 5883c6eba517, function field_is_last() was incorrectly
reporting which column was the last because it was missing COL_PROC
and by purely coincidence it was correctly printing the end-of-line and
moving to the first column since the very last field was empty, and
end-of-line was added for the last non-empty token since it was seen as
the last field.
This commits correcrly prints the end-of-line for the last entrien in
the ss command.
Tested:
diff <(./ss.old -nltp) <(misc/ss -nltp)
38c38
< LISTEN 0 128 [::1]:35417 [::]:* users:(("foo",pid=65254,fd=116))
\ No newline at end of file
---
> LISTEN 0 128 [::1]:35417 [::]:* users:(("foo",pid=65254,fd=116))
Cc: Hritik Vijay <hritikxx8@gmail.com>
Fixes: 5883c6eba517 ("ss: show header for --processes/-p")
Signed-off-by: Brian Vazquez <brianvv@google.com>
---
misc/ss.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/misc/ss.c b/misc/ss.c
index c58e5c4d..95f1d37a 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -1290,6 +1290,11 @@ static void render(void)
token = buf_token_next(token);
}
+ /* Deal with final end-of-line when the last non-empty field printed
+ * is not the last field.
+ */
+ if (line_started)
+ printf("\n");
buf_free_all();
current_field = columns;
--
2.24.0.432.g9d3f5f5b63-goog
next reply other threads:[~2019-11-27 5:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-27 5:21 Brian Vazquez [this message]
2019-12-03 13:00 ` [PATCH iproute2] ss: fix end-of-line printing in misc/ss.c Michal Kubecek
2019-12-04 19:11 ` Stephen Hemminger
2019-12-04 19:39 ` Brian Vazquez
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=20191127052118.163594-1-brianvv@google.com \
--to=brianvv@google.com \
--cc=brianvv.kernel@gmail.com \
--cc=dsahern@gmail.com \
--cc=hritikxx8@gmail.com \
--cc=maheshb@google.com \
--cc=maze@google.com \
--cc=netdev@vger.kernel.org \
--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).