]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: stats: workaround stupid and bogus -Werror=format-security behaviour
authorWilly Tarreau <w@1wt.eu>
Wed, 28 May 2014 23:04:35 +0000 (01:04 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 28 May 2014 23:07:31 +0000 (01:07 +0200)
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 :-(

src/dumpstats.c

index fcfad4a0c2b1f7b47814c84626b462304df25e3d..7c2170149b738e87f1c3fd6ba59c58a34cc8e42e 100644 (file)
@@ -3056,7 +3056,8 @@ static int stats_dump_sv_stats(struct stream_interface *si, struct proxy *px, in
                }
                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));