aboutsummaryrefslogtreecommitdiffstats
path: root/src/classifiers/bayes.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/classifiers/bayes.c')
-rw-r--r--src/classifiers/bayes.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/classifiers/bayes.c b/src/classifiers/bayes.c
index 5998d0fdb..f45f84a38 100644
--- a/src/classifiers/bayes.c
+++ b/src/classifiers/bayes.c
@@ -397,6 +397,24 @@ bayes_learn_spam (struct classifier_ctx* ctx, statfile_pool_t *pool,
if ((file = statfile_pool_is_open (pool, st->path)) == NULL) {
if ((file = statfile_pool_open (pool, st->path, st->size, FALSE)) == NULL) {
msg_warn ("cannot open %s", st->path);
+ if (statfile_pool_create (pool, st->path, st->size) == -1) {
+ msg_err ("cannot create statfile %s", st->path);
+ g_set_error (err,
+ bayes_error_quark(), /* error domain */
+ 1, /* error code */
+ "cannot create statfile: %s",
+ st->path);
+ return FALSE;
+ }
+ if ((file = statfile_pool_open (pool, st->path, st->size, FALSE)) == NULL) {
+ g_set_error (err,
+ bayes_error_quark(), /* error domain */
+ 1, /* error code */
+ "cannot open statfile %s after creation",
+ st->path);
+ msg_err ("cannot open statfile %s after creation", st->path);
+ return FALSE;
+ }
cur = g_list_next (cur);
continue;
}