diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-12-07 18:16:44 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-12-07 18:16:44 +0000 |
commit | aaf38beddb6b78d15c0e1cbca0857ea001c15b34 (patch) | |
tree | 7b06e158e448904c34e4044e510fb975914274b9 | |
parent | c53d481a3c8244300719b9cf4e084c52374466f2 (diff) | |
download | rspamd-aaf38beddb6b78d15c0e1cbca0857ea001c15b34.tar.gz rspamd-aaf38beddb6b78d15c0e1cbca0857ea001c15b34.zip |
Fix hs_helper startup
-rw-r--r-- | src/hs_helper.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/hs_helper.c b/src/hs_helper.c index 6bc9c3d18..0e912daa1 100644 --- a/src/hs_helper.c +++ b/src/hs_helper.c @@ -42,7 +42,7 @@ worker_t hs_helper_worker = { init_hs_helper, /* Init function */ start_hs_helper, /* Start function */ FALSE, /* No socket */ - FALSE, /* Unique */ + TRUE, /* Unique */ FALSE, /* Non threaded */ TRUE, /* Killable */ SOCK_STREAM /* TCP socket */ @@ -69,7 +69,7 @@ init_hs_helper (struct rspamd_config *cfg) ctx->cfg = cfg; ctx->hs_dir = RSPAMD_DBDIR "/"; - rspamd_rcl_register_worker_option (cfg, type, "cachedir", + rspamd_rcl_register_worker_option (cfg, type, "cache_dir", rspamd_rcl_parse_struct_string, ctx, G_STRUCT_OFFSET (struct hs_helper_ctx, hs_dir), 0); @@ -85,6 +85,7 @@ rspamd_hs_helper_cleanup_dir (struct hs_helper_ctx *ctx) struct stat st; glob_t globbuf; guint len, i; + gint rc; gchar *pattern; gboolean ret = TRUE; @@ -96,11 +97,11 @@ rspamd_hs_helper_cleanup_dir (struct hs_helper_ctx *ctx) } globbuf.gl_offs = 0; - len = strlen (ctx->hs_dir) + sizeof ("*.hs"); + len = strlen (ctx->hs_dir) + 1 + sizeof ("*.hs"); pattern = g_malloc (len); - rspamd_snprintf (pattern, len, "%s%s", ctx->hs_dir, "*.hs"); + rspamd_snprintf (pattern, len, "%s%c%s", ctx->hs_dir, G_DIR_SEPARATOR, "*.hs"); - if (glob (pattern, GLOB_DOOFFS, NULL, &globbuf) == 0) { + if ((rc = glob (pattern, GLOB_DOOFFS, NULL, &globbuf)) == 0) { for (i = 0; i < globbuf.gl_pathc; i++) { if (unlink (globbuf.gl_pathv[i]) == -1) { msg_err ("cannot unlink %s: %s", globbuf.gl_pathv[i], @@ -109,7 +110,7 @@ rspamd_hs_helper_cleanup_dir (struct hs_helper_ctx *ctx) } } } - else { + else if (rc != GLOB_NOMATCH) { msg_err ("glob %s failed: %s", pattern, strerror (errno)); ret = FALSE; } |