Skip to content

Commit 8e04860

Browse files
committed
MINOR: debug: make mark_tainted() return the previous value
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.
1 parent 84340d1 commit 8e04860

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/haproxy/bug.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,9 @@ extern unsigned int tainted;
337337

338338
void complain(int *counter, const char *msg, int taint);
339339

340-
static inline void mark_tainted(const enum tainted_flags flag)
340+
static inline unsigned int mark_tainted(const enum tainted_flags flag)
341341
{
342-
HA_ATOMIC_OR(&tainted, flag);
342+
return HA_ATOMIC_FETCH_OR(&tainted, flag);
343343
}
344344

345345
static inline unsigned int get_tainted()

0 commit comments

Comments
 (0)