]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
tc: u32: errors should be printed on stderr
authorStephen Hemminger <stephen@networkplumber.org>
Fri, 9 Feb 2024 16:47:06 +0000 (08:47 -0800)
committerStephen Hemminger <stephen@networkplumber.org>
Sat, 10 Feb 2024 17:48:49 +0000 (09:48 -0800)
Don't corrupt stdout with error messages, matters if JSON is used.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
tc/f_u32.c

index 936dbd65d57e2f328b8d3e14324a4251bd52bf22..913ec1de435d200091df9ea2e10fb11d9cd98556 100644 (file)
@@ -1300,7 +1300,7 @@ static int u32_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt,
 
        if (tb[TCA_U32_PCNT]) {
                if (RTA_PAYLOAD(tb[TCA_U32_PCNT])  < sizeof(*pf)) {
-                       fprintf(f, "Broken perf counters\n");
+                       fprintf(stderr, "Broken perf counters\n");
                        return -1;
                }
                pf = RTA_DATA(tb[TCA_U32_PCNT]);
@@ -1315,7 +1315,7 @@ static int u32_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt,
                struct tc_u32_mark *mark = RTA_DATA(tb[TCA_U32_MARK]);
 
                if (RTA_PAYLOAD(tb[TCA_U32_MARK]) < sizeof(*mark)) {
-                       fprintf(f, "\n  Invalid mark (kernel&iproute2 mismatch)\n");
+                       fprintf(stderr, "Invalid mark (kernel&iproute2 mismatch)\n");
                } else {
                        print_nl();
                        print_0xhex(PRINT_ANY, "fwmark_value", "  mark 0x%04x ", mark->val);