]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: debug: make mark_tainted() return the previous value
authorWilly Tarreau <w@1wt.eu>
Sat, 19 Oct 2024 13:12:47 +0000 (15:12 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 19 Oct 2024 13:13:47 +0000 (15:13 +0200)
Since mark_tainted() uses atomic ops to update the tainted status, let's
make it return the prior value, which will allow the caller to detect
if it's the first one to set it or not.

include/haproxy/bug.h

index f45fe347b46b0810b74d4cd504a16b6a51324829..5e683974fe1f17aceebc3f45f94b6135217ec990 100644 (file)
@@ -337,9 +337,9 @@ extern unsigned int tainted;
 
 void complain(int *counter, const char *msg, int taint);
 
-static inline void mark_tainted(const enum tainted_flags flag)
+static inline unsigned int mark_tainted(const enum tainted_flags flag)
 {
-       HA_ATOMIC_OR(&tainted, flag);
+       return HA_ATOMIC_FETCH_OR(&tainted, flag);
 }
 
 static inline unsigned int get_tainted()