From: Vsevolod Stakhov Date: Mon, 23 Feb 2015 16:00:07 +0000 (+0000) Subject: Try to open statfile if it is not found. X-Git-Tag: 0.9.0~634 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=629938bacad71fd6754d96e6a524463fe438bac5;p=thirdparty%2Frspamd.git Try to open statfile if it is not found. --- diff --git a/src/libstat/backends/mmaped_file.c b/src/libstat/backends/mmaped_file.c index 2e57091496..dc4c1c5994 100644 --- a/src/libstat/backends/mmaped_file.c +++ b/src/libstat/backends/mmaped_file.c @@ -865,7 +865,7 @@ rspamd_mmaped_file_runtime (struct rspamd_statfile_config *stcf, gboolean learn, mf = rspamd_mmaped_file_is_open (ctx, stcf); - if (mf == NULL && learn) { + if (mf == NULL) { /* Create file here */ filenameo = ucl_object_find_key (stcf->opts, "filename"); @@ -877,18 +877,19 @@ rspamd_mmaped_file_runtime (struct rspamd_statfile_config *stcf, gboolean learn, } } + if (learn) { + filename = ucl_object_tostring (filenameo); - filename = ucl_object_tostring (filenameo); + sizeo = ucl_object_find_key (stcf->opts, "size"); + if (sizeo == NULL || ucl_object_type (sizeo) != UCL_INT) { + msg_err ("statfile %s has no size defined", stcf->symbol); + return NULL; + } - sizeo = ucl_object_find_key (stcf->opts, "size"); - if (sizeo == NULL || ucl_object_type (sizeo) != UCL_INT) { - msg_err ("statfile %s has no size defined", stcf->symbol); - return NULL; + size = ucl_object_toint (sizeo); + rspamd_mmaped_file_create (ctx, filename, size, stcf); } - size = ucl_object_toint (sizeo); - rspamd_mmaped_file_create (ctx, filename, size, stcf); - mf = rspamd_mmaped_file_open (ctx, filename, size, stcf); }