From 27ae0fa340dfba63c54e1d69b6ec48cb8d5c41d3 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Thu, 2 Jan 2020 16:35:24 +0100 Subject: [PATCH] Fix "ERROR renaming 'data/reputation.db.tmp'" on Windows. Reported by hc2995, notipa and floffy. --- src/modules/reputation.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/modules/reputation.c b/src/modules/reputation.c index a6b9d2ae3..27bbda80b 100644 --- a/src/modules/reputation.c +++ b/src/modules/reputation.c @@ -434,6 +434,10 @@ write_fail: /* Everything went fine. We rename our temporary file to the existing * DB file (will overwrite), which is more or less an atomic operation. */ +#ifdef _WIN32 + /* The rename operation cannot be atomic on Windows as it will cause a "file exists" error */ + unlink(cfg.database); +#endif if (rename(tmpfname, cfg.database) < 0) { config_error("ERROR renaming '%s' to '%s': %s -- DATABASE *NOT* SAVED!!!",