[Box Backup-commit] COMMIT r1278 - box/chris/merge/lib/backupclient

boxbackup-dev@fluffy.co.uk boxbackup-dev@fluffy.co.uk
Fri, 09 Feb 2007 23:10:26 +0000


Author: chris
Date: 2007-02-09 23:10:25 +0000 (Fri, 09 Feb 2007)
New Revision: 1278

Modified:
   box/chris/merge/lib/backupclient/BackupClientRestore.cpp
Log:
Log failure to delete files and directories (refs #3)


Modified: box/chris/merge/lib/backupclient/BackupClientRestore.cpp
===================================================================
--- box/chris/merge/lib/backupclient/BackupClientRestore.cpp	2007-02-09 23:06:53 UTC (rev 1277)
+++ box/chris/merge/lib/backupclient/BackupClientRestore.cpp	2007-02-09 23:10:25 UTC (rev 1278)
@@ -264,7 +264,7 @@
 				if(::unlink(rLocalDirectoryName.c_str()) != 0)
 				{
 					::syslog(LOG_ERR, "Failed to delete "
-						"directory %s: %s",
+						"file %s: %s",
 						rLocalDirectoryName.c_str(),
 						strerror(errno));
 					return Restore_UnknownError;
@@ -449,7 +449,14 @@
 				std::string localFilename(rLocalDirectoryName + DIRECTORY_SEPARATOR_ASCHAR + nm.GetClearFilename());
 				
 				// Unlink anything which already exists -- for resuming restores, we can't overwrite files already there.
-				::unlink(localFilename.c_str());
+				if(::unlink(localFilename.c_str()) == 0)
+				{
+					::syslog(LOG_ERR, "Failed to delete "
+						"file %s: %s",
+						localFilename.c_str(),
+						strerror(errno));
+					return Restore_UnknownError;
+				}
 				
 				// Request it from the store
 				rConnection.QueryGetFile(DirectoryID, en->GetObjectID());