return FALSE;
}
- rspamd_snprintf (fp, sizeof (fp), "%s/%*xs.hsmc.tmp",
- re_map->map->cfg->hs_cache_dir,
- (gint)rspamd_cryptobox_HASHBYTES / 2, re_map->re_digest);
+ rspamd_snprintf (fp, sizeof (fp), "%s/hsmc-XXXXXXXXXXXXX",
+ re_map->map->cfg->hs_cache_dir);
- if ((fd = rspamd_file_xopen (fp, O_WRONLY | O_CREAT | O_EXCL, 00644, 0)) != -1) {
+ if ((fd = g_mkstemp_full(fp, O_WRONLY | O_CREAT | O_EXCL, 00644)) != -1) {
if (hs_serialize_database (rspamd_hyperscan_get_database(re_map->hs_db), &bytes, &len) == HS_SUCCESS) {
if (write (fd, bytes, len) == -1) {
msg_warn_map ("cannot write hyperscan cache to %s: %s",
g_hash_table_iter_init (&cit, re_class->re);
n = g_hash_table_size (re_class->re);
- hs_flags = g_malloc0 (sizeof (*hs_flags) * n);
- hs_ids = g_malloc (sizeof (*hs_ids) * n);
- hs_pats = g_malloc (sizeof (*hs_pats) * n);
- hs_exts = g_malloc0 (sizeof (*hs_exts) * n);
+ hs_flags = g_new0(guint, n);
+ hs_ids = g_new0(guint, n);
+ hs_pats = g_new0(char *, n);
+ hs_exts = g_new0(const hs_expr_ext_t *, n);
i = 0;
while (g_hash_table_iter_next (&cit, &k, &v)) {