[Box Backup-commit] COMMIT r1270 - box/chris/merge/bin/bbackupd

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Thu Jan 25 20:48:12 GMT 2007


Author: chris
Date: 2007-01-25 20:48:12 +0000 (Thu, 25 Jan 2007)
New Revision: 1270

Modified:
   box/chris/merge/bin/bbackupd/BackupDaemon.cpp
Log:
Stop locations from being deleted from the store just because their local
directory can't be found, as suggested by Gary (refs #3) 


Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp
===================================================================
--- box/chris/merge/bin/bbackupd/BackupDaemon.cpp	2007-01-21 13:53:51 UTC (rev 1269)
+++ box/chris/merge/bin/bbackupd/BackupDaemon.cpp	2007-01-25 20:48:12 UTC (rev 1270)
@@ -1478,7 +1478,23 @@
 			// Read the exclude lists from the Configuration
 			ploc->mpExcludeFiles = BackupClientMakeExcludeList_Files(i->second);
 			ploc->mpExcludeDirs = BackupClientMakeExcludeList_Dirs(i->second);
-			
+			// Does this exist on the server?
+			// Remove from dir object early, so that if we fail
+			// to stat the local directory, we still don't 
+			// consider to remote one for deletion.
+			BackupStoreDirectory::Iterator iter(dir);
+			BackupStoreFilenameClear dirname(ploc->mName);	// generate the filename
+			BackupStoreDirectory::Entry *en = iter.FindMatchingClearName(dirname);
+			int64_t oid = 0;
+			if(en != 0)
+			{
+				oid = en->GetObjectID();
+				
+				// Delete the entry from the directory, so we get a list of
+				// unused root directories at the end of this.
+				dir.DeleteEntry(oid);
+			}
+		
 			// Do a fsstat on the pathname to find out which mount it's on
 			{
 
@@ -1556,20 +1572,8 @@
 			}
 		
 			// Does this exist on the server?
-			BackupStoreDirectory::Iterator iter(dir);
-			BackupStoreFilenameClear dirname(ploc->mName);	// generate the filename
-			BackupStoreDirectory::Entry *en = iter.FindMatchingClearName(dirname);
-			int64_t oid = 0;
-			if(en != 0)
+			if(en == 0)
 			{
-				oid = en->GetObjectID();
-				
-				// Delete the entry from the directory, so we get a list of
-				// unused root directories at the end of this.
-				dir.DeleteEntry(oid);
-			}
-			else
-			{
 				// Doesn't exist, so it has to be created on the server. Let's go!
 				// First, get the directory's attributes and modification time
 				box_time_t attrModTime = 0;




More information about the Boxbackup-commit mailing list