BUG/MINOR: server-state: use the argument, not the global state
authorWilly Tarreau <w@1wt.eu>
Fri, 12 Mar 2021 13:09:10 +0000 (14:09 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 12 Mar 2021 13:13:07 +0000 (14:13 +0100)
commit47a30c456c8ba8c77a501aa43cd4a1ce79f6941b
treedda105a5f894cff9a1226d9560f0dd68efafc35b
parent6d4173e62291ae81ad4882a70871eefd46630b38
BUG/MINOR: server-state: use the argument, not the global state

The refactoring in commit 131b07be3 ("MEDIUM: server: Refactor
apply_server_state() to make it more readable") also had a copy-paste
error resulting in using global.server_state_file instead of the
function's argument, which easily crashes with a conf having a
state file in a backend and no global state file.

In addition, let's simplify the code and get rid of strcpy() which
almost certainly will break the build on OpenBSD.

This was introduced in 2.4-dev10, no backport is needed.
src/server_state.c