mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
CLEANUP: state-file: make the path concatenation code a bit more consistent
There are as many ways to build the globalfilepathlen variable as branches in the if/then/else, creating lots of confusion. Address the most obvious parts, but some polishing definitely is still needed.
This commit is contained in:
parent
17f8b90736
commit
5dfb6c4cc9
@ -3164,14 +3164,13 @@ void apply_server_state(void)
|
||||
}
|
||||
else if (global.server_state_base) {
|
||||
len = strlen(global.server_state_base);
|
||||
globalfilepathlen += len;
|
||||
|
||||
if (globalfilepathlen > MAXPATHLEN) {
|
||||
if (len > MAXPATHLEN) {
|
||||
globalfilepathlen = 0;
|
||||
goto globalfileerror;
|
||||
}
|
||||
memcpy(globalfilepath, global.server_state_base, len);
|
||||
globalfilepath[globalfilepathlen] = 0;
|
||||
globalfilepath[len] = 0;
|
||||
globalfilepathlen = len;
|
||||
|
||||
/* append a slash if needed */
|
||||
if (!globalfilepathlen || globalfilepath[globalfilepathlen - 1] != '/') {
|
||||
|
Loading…
x
Reference in New Issue
Block a user