[Box Backup-dev] COMMIT r777 - box/chris/general/bin/bbackupd

boxbackup-dev@fluffy.co.uk boxbackup-dev@fluffy.co.uk
Fri, 11 Aug 2006 09:35:59 +0100


Author: chris
Date: 2006-08-11 09:35:59 +0100 (Fri, 11 Aug 2006)
New Revision: 777

Modified:
   box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp
Log:
* BackupClientDirectoryRecord.cpp
- Use en->d_type field on Windows to determine file type, and thus whether
  to include or exclude, without statting it first (in case it's locked).


Modified: box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp
===================================================================
--- box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp	2006-08-11 08:35:03 UTC (rev 776)
+++ box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp	2006-08-11 08:35:59 UTC (rev 777)
@@ -235,6 +235,9 @@
 				// Stat file to get info
 				filename = MakeFullPath(rLocalPath, en->d_name);
 
+				#ifdef WIN32
+				int type = en->d_type;
+				#else
 				if(::lstat(filename.c_str(), &st) != 0)
 				{
 					// Report the error (logs and 
@@ -247,6 +250,8 @@
 				}
 
 				int type = st.st_mode & S_IFMT;
+				#endif
+
 				if(type == S_IFREG || type == S_IFLNK)
 				{
 					// File or symbolic link
@@ -277,11 +282,31 @@
 				}
 				else
 				{
+					#ifdef WIN32
+					::syslog(LOG_ERR, "Unknown file type: "
+						"%d (%s)", type, 
+						filename.c_str());
+					#endif
 					continue;
 				}
 
 				// Here if the object is something to back up (file, symlink or dir, not excluded)
 				// So make the information for adding to the checksum
+
+				#ifdef WIN32
+				if(::lstat(filename.c_str(), &st) != 0)
+				{
+					// Report the error (logs and 
+					// eventual email to administrator)
+					SetErrorWhenReadingFilesystemObject(
+						rParams, filename.c_str());
+
+					// Ignore this entry for now.
+					continue;
+				}
+				#endif
+
+
 				checksum_info.mModificationTime = FileModificationTime(st);
 				checksum_info.mAttributeModificationTime = FileAttrModificationTime(st);
 				checksum_info.mSize = st.st_size;