[Box Backup-commit] COMMIT r3494 - in box/trunk/lib: backupstore raidfile

subversion at boxbackup.org subversion at boxbackup.org
Fri Dec 26 23:16:46 GMT 2014


Author: chris
Date: 2014-12-26 23:16:46 +0000 (Fri, 26 Dec 2014)
New Revision: 3494

Modified:
   box/trunk/lib/backupstore/BackupStoreCheck.cpp
   box/trunk/lib/raidfile/RaidFileRead.cpp
Log:
Fix test failures caused by using plain stat() instead of emu_stat().

On Windows, plain stat() no longer handles slashes in filenames correctly
(since upgrading MinGW? Or switching to 64-bit Windows?). We need to use
POSIX fstat() for now in RaidFile, but we can still use the emu_stat,
and in fact we should, to fix path translation.

Modified: box/trunk/lib/backupstore/BackupStoreCheck.cpp
===================================================================
--- box/trunk/lib/backupstore/BackupStoreCheck.cpp	2014-12-26 23:16:42 UTC (rev 3493)
+++ box/trunk/lib/backupstore/BackupStoreCheck.cpp	2014-12-26 23:16:46 UTC (rev 3494)
@@ -335,9 +335,10 @@
 			{
 				// build name
 				std::string dn(rdiscSet[l] + DIRECTORY_SEPARATOR + rDirName);
-				struct stat st;
+				EMU_STRUCT_STAT st;
 
-				if(stat(dn.c_str(), &st) != 0 && errno == ENOENT)
+				if(EMU_STAT(dn.c_str(), &st) != 0 &&
+					errno == ENOENT)
 				{
 					if(mkdir(dn.c_str(), 0755) != 0)
 					{

Modified: box/trunk/lib/raidfile/RaidFileRead.cpp
===================================================================
--- box/trunk/lib/raidfile/RaidFileRead.cpp	2014-12-26 23:16:42 UTC (rev 3493)
+++ box/trunk/lib/raidfile/RaidFileRead.cpp	2014-12-26 23:16:46 UTC (rev 3494)
@@ -1498,8 +1498,8 @@
 		std::string dn(rSet[l] + DIRECTORY_SEPARATOR + rDirName);
 		
 		// check for existence
-		struct stat st;
-		if(::stat(dn.c_str(), &st) == 0)
+		EMU_STRUCT_STAT st;
+		if(EMU_STAT(dn.c_str(), &st) == 0)
 		{
 			// Directory?
 			if(st.st_mode & S_IFDIR)
@@ -1617,9 +1617,9 @@
 #ifdef HAVE_VALID_DIRENT_D_TYPE
 				if(DirReadType == DirReadType_FilesOnly && en->d_type == DT_REG)
 #else
-				struct stat st;
+				EMU_STRUCT_STAT st;
 				std::string fullName(dn + DIRECTORY_SEPARATOR + en->d_name);
-				if(::lstat(fullName.c_str(), &st) != 0)
+				if(EMU_LSTAT(fullName.c_str(), &st) != 0)
 				{
 					THROW_EXCEPTION(RaidFileException, OSError)
 				}




More information about the Boxbackup-commit mailing list