Browse Source

Add guard for fuzzy storage.

tags/1.0.0
Vsevolod Stakhov 8 years ago
parent
commit
8e91417863
2 changed files with 6 additions and 1 deletions
  1. 1
    1
      src/fuzzy_storage.c
  2. 5
    0
      src/libserver/fuzzy_backend.c

+ 1
- 1
src/fuzzy_storage.c View File

@@ -346,7 +346,7 @@ start_fuzzy (struct rspamd_worker *worker)
if ((ctx->backend = rspamd_fuzzy_backend_open (ctx->hashfile, &err)) == NULL) {
msg_err ("cannot open backend: %e", err);
g_error_free (err);
exit (EXIT_FAILURE);
exit (EXIT_SUCCESS);
}

server_stat->fuzzy_hashes = rspamd_fuzzy_backend_count (ctx->backend);

+ 5
- 0
src/libserver/fuzzy_backend.c View File

@@ -391,6 +391,11 @@ rspamd_fuzzy_backend_open (const gchar *path, GError **err)
fallback_journal[] = "PRAGMA journal_mode=\"off\";";
int rc;

if (path == NULL) {
g_set_error (err, rspamd_fuzzy_backend_quark (),
ENOENT, "Path has not been specified");
return NULL;
}
/* First of all we check path for existence */
dir = g_path_get_dirname (path);
if (dir == NULL) {

Loading…
Cancel
Save