Skip to contentSkip to conversation

tc: bpf: fix extra newline in JSON output

PATCH Applied Stephen Hemminger 2 participants 3 messages Feb 9, 2024 – Feb 10, 2024

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

PATCH 1/2 tc: bpf: fix extra newline in JSON output

Don't print newline at end of bpf if in JSON mode.

---
 tc/m_bpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tc/m_bpf.c +1 -1
index 4eadcb6daac4..da50c05e1529 100644
@@ -204,7 +204,7 @@ static int bpf_print_opt(struct action_util *au, FILE *f, struct rtattr *arg)
 		}
 	}
 
-	fprintf(f, "\n ");
+	print_string(PRINT_FP, NULL, "%s", "\n ");
 	return 0;
 }
 
Signature · 1 line
2.43.0
#1 lore raw

PATCH 2/2 tc: print unknown action on stderr

This is an error, and should not go to stdout.

---
 tc/m_action.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tc/m_action.c +1 -1
index 16474c56118c..f180ba09778c 100644
@@ -62,7 +62,7 @@ static void act_usage(void)
 static int print_noaopt(struct action_util *au, FILE *f, struct rtattr *opt)
 {
 	if (opt && RTA_PAYLOAD(opt))
-		fprintf(f, "[Unknown action, optlen=%u] ",
+		fprintf(stderr, "[Unknown action, optlen=%u] ",
 			(unsigned int) RTA_PAYLOAD(opt));
 	return 0;
 }
Signature · 1 line
2.43.0
#2 lore raw
In reply to Stephen Hemminger
This series was applied to iproute2/iproute2.git (main) by Stephen Hemminger <[email protected]>:

Hello:

This series was applied to iproute2/iproute2.git (main) by Stephen Hemminger <[email protected]>:

Quoted 6 lines · On Fri, 9 Feb 2024 15:55:56 -0800 you wrote:

Don't print newline at end of bpf if in JSON mode.

---
 tc/m_bpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
- [iproute2,1/2] tc: bpf: fix extra newline in JSON output

    https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=46031294e3e2
  - [iproute2,2/2] tc: print unknown action on stderr
    https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=b958d3c25dcc

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html