diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-02-23 16:00:07 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-02-23 16:00:07 +0000 |
commit | 629938bacad71fd6754d96e6a524463fe438bac5 (patch) | |
tree | 835206efcfeb5a7d0f8ba228cffe06117ab9a0ec /src/libstat | |
parent | 909da7b7b642531ca024df35bcd8c95ecbb1549f (diff) | |
download | rspamd-629938bacad71fd6754d96e6a524463fe438bac5.tar.gz rspamd-629938bacad71fd6754d96e6a524463fe438bac5.zip |
Try to open statfile if it is not found.
Diffstat (limited to 'src/libstat')
-rw-r--r-- | src/libstat/backends/mmaped_file.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/libstat/backends/mmaped_file.c b/src/libstat/backends/mmaped_file.c index 2e5709149..dc4c1c599 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); } |