[Box Backup-commit] COMMIT r1921 - box/trunk/lib/backupclient

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Sun Nov 4 16:34:41 GMT 2007


Author: chris
Date: 2007-11-04 16:34:41 +0000 (Sun, 04 Nov 2007)
New Revision: 1921

Modified:
   box/trunk/lib/backupclient/BackupClientRestore.cpp
Log:
Really fix unlink() during restore, fixes [1919].


Modified: box/trunk/lib/backupclient/BackupClientRestore.cpp
===================================================================
--- box/trunk/lib/backupclient/BackupClientRestore.cpp	2007-11-04 16:33:53 UTC (rev 1920)
+++ box/trunk/lib/backupclient/BackupClientRestore.cpp	2007-11-04 16:34:41 UTC (rev 1921)
@@ -453,8 +453,11 @@
 				BackupStoreFilenameClear nm(en->GetName());
 				std::string localFilename(rLocalDirectoryName + DIRECTORY_SEPARATOR_ASCHAR + nm.GetClearFilename());
 				
-				// Unlink anything which already exists -- for resuming restores, we can't overwrite files already there.
-				if(::unlink(localFilename.c_str()) != 0)
+				// Unlink anything which already exists:
+				// For resuming restores, we can't overwrite
+				// files already there.
+				if(ObjectExists(localFilename) != ObjectExists_NoObject &&
+					::unlink(localFilename.c_str()) != 0)
 				{
 					BOX_ERROR("Failed to delete file '" <<
 						localFilename << "': " <<




More information about the Boxbackup-commit mailing list