[Box Backup-commit] COMMIT r1963 - box/chris/general/lib/backupclient
boxbackup-dev@fluffy.co.uk
boxbackup-dev@fluffy.co.uk
Sat, 8 Dec 2007 22:08:55 +0000 (UTC)
Author: chris
Date: 2007-12-08 22:08:55 +0000 (Sat, 08 Dec 2007)
New Revision: 1963
Modified:
box/chris/general/lib/backupclient/BackupClientRestore.cpp
Log:
Fix restoring over existing files (merges [1919], [1921])
Modified: box/chris/general/lib/backupclient/BackupClientRestore.cpp
===================================================================
--- box/chris/general/lib/backupclient/BackupClientRestore.cpp 2007-12-08 22:07:35 UTC (rev 1962)
+++ box/chris/general/lib/backupclient/BackupClientRestore.cpp 2007-12-08 22:08:55 UTC (rev 1963)
@@ -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 << "': " <<