From: Marcos de Oliveira <[email protected]>
On a clean installation, users might want to use server-state-file and
the recommended zero-warning option. This caused a problem if
server-state-file was not found, as a warning was emited, causing
startup to fail.
This will allow users to specify nonexistent server-state-file at first,
and dump states to the file later.
Fixes #2190
---
src/server_state.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/server_state.c b/src/server_state.c
index d2cc4d820..93dbd20f1 100644
--- a/src/server_state.c
+++ b/src/server_state.c
@@ -798,7 +798,10 @@ void apply_server_state(void)
errno = 0;
f = fopen(file, "r");
if (!f) {
- ha_warning("config: Can't open global server state file '%s':
%s\n", file, strerror(errno));
+ if (errno == ENOENT)
+ ha_notice("config: Can't open global server state file
'%s': %s\n", file, strerror(errno));
+ else
+ ha_warning("config: Can't open global server state file
'%s': %s\n", file, strerror(errno));
goto no_globalfile;
}
@@ -866,8 +869,12 @@ void apply_server_state(void)
errno = 0;
f = fopen(file, "r");
if (!f) {
- ha_warning("Proxy '%s': Can't open server state file
'%s': %s.\n",
- curproxy->id, file, strerror(errno));
+ if (errno == ENOENT)
+ ha_notice("Proxy '%s': Can't open server state
file '%s': %s.\n",
+ curproxy->id, file, strerror(errno));
+ else
+ ha_warning("Proxy '%s': Can't open server state
file '%s': %s.\n",
+ curproxy->id, file, strerror(errno));
continue; /* next proxy */
}
--
2.25.1