[Box Backup-dev] COMMIT r605 - box/chris/general/lib/raidfile

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Tue May 30 20:25:35 BST 2006


Author: chris
Date: 2006-05-30 19:25:31 +0000 (Tue, 30 May 2006)
New Revision: 605

Modified:
   box/chris/general/lib/raidfile/RaidFileWrite.cpp
Log:
* RaidFileWrite.cpp
- Unlink files before renaming over them on Win32


Modified: box/chris/general/lib/raidfile/RaidFileWrite.cpp
===================================================================
--- box/chris/general/lib/raidfile/RaidFileWrite.cpp	2006-05-30 19:24:51 UTC (rev 604)
+++ box/chris/general/lib/raidfile/RaidFileWrite.cpp	2006-05-30 19:25:31 UTC (rev 605)
@@ -567,9 +567,17 @@
 
 #ifdef WIN32
 		// Must delete before renaming
-		::unlink(stripe1Filename.c_str());
-		::unlink(stripe2Filename.c_str());
-		::unlink(parityFilename.c_str());
+		#define CHECK_UNLINK(file) \
+		{ \
+			if (::unlink(file) != 0 && errno != ENOENT) \
+			{ \
+				THROW_EXCEPTION(RaidFileException, OSError); \
+			} \
+		}
+		CHECK_UNLINK(stripe1Filename.c_str());
+		CHECK_UNLINK(stripe2Filename.c_str());
+		CHECK_UNLINK(parityFilename.c_str());
+		#undef CHECK_UNLINK
 #endif
 		
 		// Rename them into place




More information about the Boxbackup-dev mailing list