Browse code

freshclam/manager.c: fix rename() problem on w32 (bb#1084)

git-svn: trunk@3944

Tomasz Kojm authored on 2008/07/14 21:21:34
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Mon Jul 14 13:57:15 CEST 2008 (tk)
2
+----------------------------------
3
+  * freshclam/manager.c: fix rename() problem on w32 (bb#1084)
4
+
1 5
 Mon Jul 14 10:47:22 CEST 2008 (tk)
2 6
 ----------------------------------
3 7
   * freshclam/mirman.c: fix compilation error on w32 (bb#1095)
... ...
@@ -1260,6 +1260,15 @@ static int updatedb(const char *dbname, const char *hostname, char *ip, int *sig
1260 1260
 	return 53;
1261 1261
     }
1262 1262
 
1263
+#ifdef C_WINDOWS
1264
+    if(!access(newdb, R_OK) && unlink(newdb)) {
1265
+	logg("!Can't unlink %s. Please fix the problem manually and try again.\n", newdb);
1266
+	unlink(newfile);
1267
+	free(newfile);
1268
+	return 53;
1269
+    }
1270
+#endif
1271
+
1263 1272
     if(rename(newfile, newdb) == -1) {
1264 1273
 	logg("!Can't rename %s to %s: %s\n", newfile, newdb, strerror(errno));
1265 1274
 	unlink(newfile);