BUILD: stats: workaround stupid and bogus -Werror=format-security behaviour
As reported by Vincent Bernat and Ryan O'Hara, building haproxy with the
option above causes this :
src/dumpstats.c: In function 'stats_dump_sv_stats':
src/dumpstats.c:3059:4: error: format not a string literal and no format arguments [-Werror=format-security]
cc1: some warnings being treated as errors
make: *** [src/dumpstats.o] Error 1
With that option, gcc wants an argument after a string format even when
that string format is a const but not a litteral. It can be anything
invalid, for example an integer when a string is expected, it just
wants something. So feed it with something :-(
diff --git a/src/dumpstats.c b/src/dumpstats.c
index fcfad4a..7c21701 100644
--- a/src/dumpstats.c
+++ b/src/dumpstats.c
@@ -3056,7 +3056,8 @@
}
else if ((ref->agent.state & CHK_ST_ENABLED) && (ref->state == SRV_ST_STOPPED)) {
chunk_appendf(&trash, "%s ", human_time(now.tv_sec - ref->last_change, 1));
- chunk_appendf(&trash, srv_hlt_st[1]); /* DOWN (agent) */
+ /* DOWN (agent) */
+ chunk_appendf(&trash, srv_hlt_st[1], "GCC: your -Werror=format-security is bogus, annoying, and hides real bugs, I don't thank you, really!");
}
else if (ref->check.state & CHK_ST_ENABLED) {
chunk_appendf(&trash, "%s ", human_time(now.tv_sec - ref->last_change, 1));