]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: sample: fix the closing bracket and LF in the debug converter
authorWilly Tarreau <w@1wt.eu>
Tue, 17 Dec 2019 08:00:15 +0000 (09:00 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 17 Dec 2019 08:04:38 +0000 (09:04 +0100)
The closing bracket was emitted for the "debug" converter even when the
opening one was not sent, and the new line was not always emitted. Let's
fix this. This is harmless since this converter is not built by default.

src/sample.c

index 1e4039d27b11fd9d84d944d1e4e900f41232d02d..b3d28cab55b28fba4238cef377e3dc8c898416c5 100644 (file)
@@ -1463,7 +1463,7 @@ static int sample_conv_debug(const struct arg *arg_p, struct sample *smp, void *
 
                        else {
                                /* Display the displayable chars*. */
-                               fprintf(stderr, "<");
+                               fputc('<', stderr);
                                for (i = 0; i < tmp.data.u.str.data; i++) {
                                        if (isprint(tmp.data.u.str.area[i]))
                                                fputc(tmp.data.u.str.area[i],
@@ -1471,9 +1471,10 @@ static int sample_conv_debug(const struct arg *arg_p, struct sample *smp, void *
                                        else
                                                fputc('.', stderr);
                                }
+                               fputc('>', stderr);
                        }
-                       fprintf(stderr, ">\n");
                }
+               fputc('\n', stderr);
        }
        return 1;
 }