Skip to contentSkip to conversation

ss: fix end-of-line printing in misc/ss.c

PATCH Applied Brian Vazquez 2 participants 2 messages Dec 4, 2019 – Dec 5, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ss: fix end-of-line printing in misc/ss.c

The previous change to ss to show header broke the printing of end-of-line for the last entry.

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
---

Quoted 1 line

LISTEN 0 128 [::1]:35417 [::]:* users:(("foo",pid=65254,fd=116))

Cc Hritik Vijay <[email protected]>
Fixes 5883c6eba517 ("ss: show header for --processes/-p")

---
v2: Rewrote commit message as suggested by Stephen Hemminger.

 misc/ss.c | 5 +++++
 1 file changed, 5 insertions(+)
misc/ss.c +5 -0
index c58e5c4d..95f1d37a 100644
@@ -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;
Signature · 1 line
2.24.0.393.g34dc348eaf-goog
#1 lore raw
Quoted 9 lines · On Wed, 4 Dec 2019 13:32:28 -0800 Brian Vazquez <[email protected]> wrote:

The previous change to ss to show header broke the printing of end-of-line for the last entry.

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
---

Quoted 7 lines
Quoted 1 line

LISTEN 0 128 [::1]:35417 [::]:* users:(("foo",pid=65254,fd=116))

Cc Hritik Vijay <[email protected]>
Fixes 5883c6eba517 ("ss: show header for --processes/-p")

---

Applied