]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: fd: factorize the fd_takeover() exit path to make it safer
authorWilly Tarreau <w@1wt.eu>
Thu, 18 Jun 2020 06:14:59 +0000 (08:14 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 18 Jun 2020 06:25:42 +0000 (08:25 +0200)
commitf1cad3828158c5aeb629a663f9eced53282c4c89
tree4cba1e2ffa3afd1be23d71be89964771e6ca6c94
parent4297363de3985d0b0bd55f03420c3db200ef43da
MINOR: fd: factorize the fd_takeover() exit path to make it safer

Since there was a risk of leaving fd_takeover() without properly
stopping the fd, let's take this opportunity for factoring the code
around a commont exit point that's common to both double-cas and locked
modes. This means using the "ret" variable inside the double-CAS code,
and inverting the loop to first test the old values. Doing do also
produces cleaner code because the compiler cannot factorize common
exit paths using asm statements that are present in some atomic ops.
src/fd.c