diff options
author | Chris Wilson <chris+github@qwirx.com> | 2007-11-04 16:34:41 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2007-11-04 16:34:41 +0000 |
commit | 719ed242a8962591b4798fba9e4797ef27626e49 (patch) | |
tree | 2b6f663d26fb29b5625543b4a4d344f0001c1316 /lib/backupclient/BackupClientRestore.cpp | |
parent | f24aa2064954b1c529621c8e6425d26c0c78b1bb (diff) |
Really fix unlink() during restore, fixes [1919].
Diffstat (limited to 'lib/backupclient/BackupClientRestore.cpp')
-rw-r--r-- | lib/backupclient/BackupClientRestore.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/backupclient/BackupClientRestore.cpp b/lib/backupclient/BackupClientRestore.cpp index 58234562..b5a54964 100644 --- a/lib/backupclient/BackupClientRestore.cpp +++ b/lib/backupclient/BackupClientRestore.cpp @@ -453,8 +453,11 @@ static int BackupClientRestoreDir(BackupProtocolClient &rConnection, int64_t Dir 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 << "': " << |