]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Forgot to commit leftover changes
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 29 Jul 2016 14:59:06 +0000 (15:59 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 29 Jul 2016 15:01:53 +0000 (16:01 +0100)
src/libserver/re_cache.c

index 9fa2688a2662fe89180089ac29ca675165ce5140..b9b1b5e8c46db2d6f52bbd75b88dc791fa190ceb 100644 (file)
@@ -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;