diff options
-rw-r--r-- | src/hs_helper.c | 20 | ||||
-rw-r--r-- | src/libserver/re_cache.c | 8 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/hs_helper.c b/src/hs_helper.c index cba2ca230..c19293bb1 100644 --- a/src/hs_helper.c +++ b/src/hs_helper.c @@ -133,6 +133,10 @@ rspamd_hs_helper_cleanup_dir (struct hs_helper_ctx *ctx, gboolean forced) } globbuf.gl_offs = 0; + /* + * We reuse this buffer for .new patterns as well, so allocate with some + * margin + */ len = strlen (ctx->hs_dir) + 1 + sizeof ("*.hs.new") + 2; pattern = g_malloc (len); rspamd_snprintf (pattern, len, "%s%c%s", ctx->hs_dir, G_DIR_SEPARATOR, "*.hs"); @@ -147,6 +151,10 @@ rspamd_hs_helper_cleanup_dir (struct hs_helper_ctx *ctx, gboolean forced) strerror (errno)); ret = FALSE; } + else { + msg_notice ("successfully removed outdated hyperscan file: %s", + globbuf.gl_pathv[i]); + } } } } @@ -193,6 +201,18 @@ rspamd_hs_helper_cleanup_dir (struct hs_helper_ctx *ctx, gboolean forced) strerror(errno)); ret = FALSE; } + else { + msg_notice ("successfully removed outdated hyperscan temporary file: %s; " + "pid of the file creator process: %P", + globbuf.gl_pathv[i], + foreign_pid); + } + } + else { + msg_notice ("skip removal of the hyperscan temporary file: %s; " + "pid of the file creator process: %P", + globbuf.gl_pathv[i], + foreign_pid); } } } diff --git a/src/libserver/re_cache.c b/src/libserver/re_cache.c index 1d2f6522f..1b591a81c 100644 --- a/src/libserver/re_cache.c +++ b/src/libserver/re_cache.c @@ -2291,10 +2291,18 @@ rspamd_re_cache_is_valid_hyperscan_file (struct rspamd_re_cache *cache, len = strlen (path); if (len < sizeof (rspamd_cryptobox_HASHBYTES + 3)) { + if (!silent) { + msg_err_re_cache ("cannot open hyperscan cache file %s: too short filename", + path); + } return FALSE; } if (memcmp (path + len - 3, ".hs", 3) != 0) { + if (!silent) { + msg_err_re_cache ("cannot open hyperscan cache file %s: not ending with .hs", + path); + } return FALSE; } |