aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2023-01-07 13:31:17 +0000
committerVsevolod Stakhov <vsevolod@rspamd.com>2023-01-07 13:31:17 +0000
commitede28c7e6b5f6d1579ffdf29ec0d9e44ad2efa58 (patch)
tree09d85ee463a873791691d4dd2a1176b243f19c8a
parent44f27a93e3fedf48ea87923da6ecc10ed26c3f9a (diff)
downloadrspamd-ede28c7e6b5f6d1579ffdf29ec0d9e44ad2efa58.tar.gz
rspamd-ede28c7e6b5f6d1579ffdf29ec0d9e44ad2efa58.zip
[Minor] Honor RSPAMD_NO_CLEANUP in hs_helper as well
-rw-r--r--src/hs_helper.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/hs_helper.c b/src/hs_helper.c
index 5995ce5e9..5dac2908e 100644
--- a/src/hs_helper.c
+++ b/src/hs_helper.c
@@ -125,6 +125,11 @@ rspamd_hs_helper_cleanup_dir (struct hs_helper_ctx *ctx, gboolean forced)
gboolean ret = TRUE;
pid_t our_pid = getpid ();
+ if (getenv("RSPAMD_NO_CLEANUP")) {
+ /* Skip all cleanup */
+ return TRUE;
+ }
+
if (stat (ctx->hs_dir, &st) == -1) {
msg_err ("cannot stat path %s, %s",
ctx->hs_dir,
@@ -137,7 +142,7 @@ rspamd_hs_helper_cleanup_dir (struct hs_helper_ctx *ctx, gboolean forced)
* We reuse this buffer for .new patterns as well, so allocate with some
* margin
*/
- len = strlen (ctx->hs_dir) + 1 + sizeof ("*.hs.new") + 2;
+ len = strlen (ctx->hs_dir) + 1 + sizeof ("*.hs") + sizeof (G_DIR_SEPARATOR);
pattern = g_malloc (len);
rspamd_snprintf (pattern, len, "%s%c%s", ctx->hs_dir, G_DIR_SEPARATOR, "*.hs");