[Box Backup-commit] COMMIT r2529 - box/trunk/lib/raidfile

boxbackup-dev at boxbackup.org boxbackup-dev at boxbackup.org
Sat Jun 27 12:28:16 BST 2009


Author: chris
Date: 2009-06-27 12:28:15 +0100 (Sat, 27 Jun 2009)
New Revision: 2529

Modified:
   box/trunk/lib/raidfile/RaidFileWrite.cpp
Log:
Improve RaidFileWrite error logging.


Modified: box/trunk/lib/raidfile/RaidFileWrite.cpp
===================================================================
--- box/trunk/lib/raidfile/RaidFileWrite.cpp	2009-06-22 05:32:59 UTC (rev 2528)
+++ box/trunk/lib/raidfile/RaidFileWrite.cpp	2009-06-27 11:28:15 UTC (rev 2529)
@@ -113,6 +113,7 @@
 		S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
 	if(mOSFileHandle == -1)
 	{
+		BOX_LOG_SYS_ERROR("Failed to open file: " << writeFilename);
 		THROW_EXCEPTION(RaidFileException, ErrorOpeningWriteFile)
 	}
 	
@@ -274,13 +275,15 @@
 	if(::unlink(renameTo.c_str()) != 0 && 
 		GetLastError() != ERROR_FILE_NOT_FOUND)
 	{
-		BOX_LOG_WIN_ERROR("failed to delete file: " << renameTo);
+		BOX_LOG_WIN_ERROR("Failed to delete file: " << renameTo);
 		THROW_EXCEPTION(RaidFileException, OSError)
 	}
 #endif
 
 	if(::rename(renameFrom.c_str(), renameTo.c_str()) != 0)
 	{
+		BOX_LOG_SYS_ERROR("Failed to rename file: " << renameFrom <<
+			" to " << renameTo);
 		THROW_EXCEPTION(RaidFileException, OSError)
 	}
 	
@@ -335,6 +338,7 @@
 		::close(mOSFileHandle) != 0)
 #endif // !WIN32
 	{
+		BOX_LOG_SYS_ERROR("Failed to delete file: " << writeFilename);
 		THROW_EXCEPTION(RaidFileException, OSError)
 	}
 	
@@ -562,6 +566,8 @@
 			ASSERT((::lseek(parity, 0, SEEK_CUR) % blockSize) == 0);
 			if(::write(parity, &sw, sizeof(sw)) != sizeof(sw))
 			{
+				BOX_LOG_SYS_ERROR("Failed to write to file: " <<
+					writeFilename);
 				THROW_EXCEPTION(RaidFileException, OSError)
 			}
 		}
@@ -600,6 +606,8 @@
 		// Finally delete the write file
 		if(::unlink(writeFilename.c_str()) != 0)
 		{
+			BOX_LOG_SYS_ERROR("Failed to delete file: " <<
+				writeFilename);
 			THROW_EXCEPTION(RaidFileException, OSError)
 		}
 	}




More information about the Boxbackup-commit mailing list