diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-07-08 21:55:04 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-07-08 21:55:04 +0100 |
commit | 7374691f84fd8e0cc64877ad6e42c6d8b3b784b8 (patch) | |
tree | 829a556edbfa724131960585a33a020b2639315f /src/hs_helper.c | |
parent | 62f2b93753586fdff2b68e9b50813f13892460af (diff) | |
download | rspamd-7374691f84fd8e0cc64877ad6e42c6d8b3b784b8.tar.gz rspamd-7374691f84fd8e0cc64877ad6e42c6d8b3b784b8.zip |
[Minor] Some more fixes towards hyperscan obsoletion reasoning
Diffstat (limited to 'src/hs_helper.c')
-rw-r--r-- | src/hs_helper.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/hs_helper.c b/src/hs_helper.c index 3a74d5dda..4ec51aef4 100644 --- a/src/hs_helper.c +++ b/src/hs_helper.c @@ -144,20 +144,29 @@ rspamd_hs_helper_cleanup_dir (struct hs_helper_ctx *ctx, gboolean forced) if ((rc = glob (pattern, 0, NULL, &globbuf)) == 0) { for (i = 0; i < globbuf.gl_pathc; i++) { GError *err = NULL; + + if (forced) { + g_set_error(&err, g_quark_from_static_string ("re_cache"), + 0, "forced removal"); + } + if (forced || !rspamd_re_cache_is_valid_hyperscan_file (ctx->cfg->re_cache, globbuf.gl_pathv[i], TRUE, TRUE, &err)) { if (unlink (globbuf.gl_pathv[i]) == -1) { - msg_err ("cannot unlink %s: %s", globbuf.gl_pathv[i], - strerror (errno)); + msg_err ("cannot unlink %s: %s (reason for expiration: %e)", globbuf.gl_pathv[i], + strerror(errno)); ret = FALSE; } else { - msg_notice ("successfully removed outdated hyperscan file: %s; %e", + msg_notice ("successfully removed outdated hyperscan file: %s; reason for expiration: %e", globbuf.gl_pathv[i], err); - g_error_free(err); } } + + if (err) { + g_error_free(err); + } } } else if (rc != GLOB_NOMATCH) { |