diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-07-29 15:59:06 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-07-29 16:01:53 +0100 |
commit | e316118b4798ac5cd73c682ee741be27383d315d (patch) | |
tree | 6abe037f9004582c4fc2d1d07d342ce02a78e967 /src/libserver/re_cache.c | |
parent | c438d74687b656e1c0cc23aee5d3220a3d80c484 (diff) | |
download | rspamd-e316118b4798ac5cd73c682ee741be27383d315d.tar.gz rspamd-e316118b4798ac5cd73c682ee741be27383d315d.zip |
[Fix] Forgot to commit leftover changes
Diffstat (limited to 'src/libserver/re_cache.c')
-rw-r--r-- | src/libserver/re_cache.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/libserver/re_cache.c b/src/libserver/re_cache.c index 9fa2688a2..b9b1b5e8c 100644 --- a/src/libserver/re_cache.c +++ b/src/libserver/re_cache.c @@ -1573,9 +1573,24 @@ rspamd_re_cache_compile_hyperscan (struct rspamd_re_cache *cache, } fsync (fd); - close (fd); /* Now rename temporary file to the new .hs file */ + rspamd_snprintf (npath, sizeof (path), "%s%c%s.hs", cache_dir, + G_DIR_SEPARATOR, re_class->hash); + + if (rename (path, npath) == -1) { + g_set_error (err, + rspamd_re_cache_quark (), + errno, + "cannot rename %s to %s: %s", + path, npath, strerror (errno)); + unlink (path); + close (fd); + + return -1; + } + + close (fd); } return total; |