BUG/MINOR: server: check return value of fopen() in apply_server_state()

fopen() can return NULL when state file is missing. This patch adds a
check of fopen() return value so we can skip processing in such case.

No backport needed.
This commit is contained in:
Vedran Furac 2019-10-16 14:49:38 +02:00 committed by Christopher Faulet
parent 4381d26edc
commit 5d48627aba
1 changed files with 2 additions and 0 deletions

View File

@ -3595,6 +3595,8 @@ void apply_server_state(void)
f = fopen(globalfilepath, "r");
if (errno)
ha_warning("Can't open global server state file '%s': %s\n", globalfilepath, strerror(errno));
if (!f)
goto out_load_server_state_in_tree;
global_file_version = srv_state_get_version(f);
if (global_file_version == 0)