]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: debug: fix get_tainted() to properly read an atomic value
authorWilly Tarreau <w@1wt.eu>
Fri, 25 Feb 2022 08:56:29 +0000 (09:56 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 25 Feb 2022 10:54:30 +0000 (11:54 +0100)
get_tainted() was using an atomic store from the atomic value to a
local one instead of using an atomic load. In practice it has no effect
given the relatively rare updates of this field and the fact that it's
read only when dumping "show info" output, but better fix it.

There's probably no need to backport this.

src/haproxy.c

index 0010e90f9ed232835f586a5f6cdb2c945c66e7b2..7a659f798c5064b8ffb9ae9ddb72cf364769ae4a 100644 (file)
@@ -1456,9 +1456,7 @@ void mark_tainted(const enum tainted_flags flag)
 
 unsigned int get_tainted()
 {
-       int tainted_state;
-       HA_ATOMIC_STORE(&tainted_state, tainted);
-       return tainted_state;
+       return HA_ATOMIC_LOAD(&tainted);
 }