if ((rc = glob (pattern, GLOB_DOOFFS, NULL, &globbuf)) == 0) {
for (i = 0; i < globbuf.gl_pathc; i++) {
if (!rspamd_re_cache_is_valid_hyperscan_file (ctx->cfg->re_cache,
- globbuf.gl_pathv[i])) {
+ globbuf.gl_pathv[i], TRUE)) {
if (unlink (globbuf.gl_pathv[i]) == -1) {
msg_err ("cannot unlink %s: %s", globbuf.gl_pathv[i],
strerror (errno));
rspamd_snprintf (path, sizeof (path), "%s%c%s.hs", cache_dir,
G_DIR_SEPARATOR, re_class->hash);
- if (rspamd_re_cache_is_valid_hyperscan_file (cache, path)) {
+ if (rspamd_re_cache_is_valid_hyperscan_file (cache, path, TRUE)) {
msg_info_re_cache ("skip already valid file for re class '%s'",
re_class->hash);
read (fd, &n, sizeof (n));
total += n;
close (fd);
+
continue;
}
gboolean
rspamd_re_cache_is_valid_hyperscan_file (struct rspamd_re_cache *cache,
- const char *path)
+ const char *path, gboolean silent)
{
g_assert (cache != NULL);
g_assert (path != NULL);
fd = open (path, O_RDONLY);
if (fd == -1) {
- msg_err_re_cache ("cannot open hyperscan cache file %s: %s",
- path, strerror (errno));
+ if (!silent) {
+ msg_err_re_cache ("cannot open hyperscan cache file %s: %s",
+ path, strerror (errno));
+ }
return FALSE;
}
}
}
- msg_warn_re_cache ("unknown hyperscan cache file %s", path);
+ if (!silent) {
+ msg_warn_re_cache ("unknown hyperscan cache file %s", path);
+ }
return FALSE;
#endif
rspamd_snprintf (path, sizeof (path), "%s%c%s.hs", cache_dir,
G_DIR_SEPARATOR, re_class->hash);
- if (rspamd_re_cache_is_valid_hyperscan_file (cache, path)) {
+ if (rspamd_re_cache_is_valid_hyperscan_file (cache, path, FALSE)) {
msg_debug_re_cache ("load hyperscan database from '%s'",
re_class->hash);