diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2020-05-31 13:21:55 +0200 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2020-06-03 14:59:20 +0200 |
commit | fae5448134dfec004be818d18ff1583cc61e5549 (patch) | |
tree | 1f305c8c5b8059dcb4fb490752413c7075efdcce /sysdep/unix/config.Y | |
parent | eee8af4db2d36a5017eac4447075cac3346e8b23 (diff) |
Log: Do not open logfiles when parse-and-exit option is active
This is a quick workaround for an issue where configured logfiles are
opened/created during parsing of a config file even when parse-and-exit
option is active. We should later refactor the logging code to avoid
opening log during parsing altogether.
Diffstat (limited to 'sysdep/unix/config.Y')
-rw-r--r-- | sysdep/unix/config.Y | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/sysdep/unix/config.Y b/sysdep/unix/config.Y index af82e5bd..5c4b5bef 100644 --- a/sysdep/unix/config.Y +++ b/sysdep/unix/config.Y @@ -50,9 +50,12 @@ log_limit: log_file: text log_limit { - this_log->rf = rf_open(new_config->pool, $1, "a"); - if (!this_log->rf) cf_error("Unable to open log file '%s': %m", $1); - this_log->fh = rf_file(this_log->rf); + if (!parse_and_exit) + { + this_log->rf = rf_open(new_config->pool, $1, "a"); + if (!this_log->rf) cf_error("Unable to open log file '%s': %m", $1); + this_log->fh = rf_file(this_log->rf); + } this_log->pos = -1; this_log->filename = $1; } @@ -88,9 +91,12 @@ conf: mrtdump_base ; mrtdump_base: MRTDUMP PROTOCOLS mrtdump_mask ';' { new_config->proto_default_mrtdump = $3; } | MRTDUMP text ';' { - struct rfile *f = rf_open(new_config->pool, $2, "a"); - if (!f) cf_error("Unable to open MRTDump file '%s': %m", $2); - new_config->mrtdump_file = rf_fileno(f); + if (!parse_and_exit) + { + struct rfile *f = rf_open(new_config->pool, $2, "a"); + if (!f) cf_error("Unable to open MRTDump file '%s': %m", $2); + new_config->mrtdump_file = rf_fileno(f); + } } ; |