Skip to content

Commit

Permalink
[Minor] Honor RSPAMD_NO_CLEANUP in hs_helper as well
Browse files Browse the repository at this point in the history
  • Loading branch information
vstakhov committed Jan 7, 2023
1 parent 44f27a9 commit ede28c7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/hs_helper.c
Expand Up @@ -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,
Expand All @@ -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");

Expand Down

0 comments on commit ede28c7

Please sign in to comment.