commit 967e5ee: [Minor] Add some logging
Vsevolod Stakhov
vsevolod at highsecure.ru
Thu May 13 14:00:03 UTC 2021
Author: Vsevolod Stakhov
Date: 2021-05-13 13:59:09 +0100
URL: https://github.com/rspamd/rspamd/commit/967e5ee83cb1e7bb17dde33686a48d27617b1e0c
[Minor] Add some logging
---
src/hs_helper.c | 20 ++++++++++++++++++++
src/libserver/re_cache.c | 8 ++++++++
2 files changed, 28 insertions(+)
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;
}
More information about the Commits
mailing list