[Box Backup-commit] COMMIT r1062 - box/chris/merge/bin/bbstored
boxbackup-dev at fluffy.co.uk
boxbackup-dev at fluffy.co.uk
Sun Oct 15 20:59:30 BST 2006
Author: chris
Date: 2006-10-15 20:59:30 +0100 (Sun, 15 Oct 2006)
New Revision: 1062
Modified:
box/chris/merge/bin/bbstored/BackupContext.cpp
Log:
Revert patch [825] (mostly).
Re-enable locking code on Win32 (although it's never used).
Use InvisibleTempFileStream to ensure that the temporary file is always
deleted. (refs #3)
Modified: box/chris/merge/bin/bbstored/BackupContext.cpp
===================================================================
--- box/chris/merge/bin/bbstored/BackupContext.cpp 2006-10-15 19:49:11 UTC (rev 1061)
+++ box/chris/merge/bin/bbstored/BackupContext.cpp 2006-10-15 19:59:30 UTC (rev 1062)
@@ -24,6 +24,7 @@
#include "BackupStoreDaemon.h"
#include "RaidFileController.h"
#include "FileStream.h"
+#include "InvisibleTempFileStream.h"
#include "MemLeakFindOn.h"
@@ -125,7 +126,6 @@
// --------------------------------------------------------------------------
bool BackupContext::AttemptToGetWriteLock()
{
-#ifndef WIN32
// Make the filename of the write lock file
std::string writeLockFile;
StoreStructure::MakeWriteLockFilename(mStoreRoot, mStoreDiscSet, writeLockFile);
@@ -151,7 +151,7 @@
} while(!gotLock && tries > 0);
}
-
+
if(gotLock)
{
// Got the lock, mark as not read only
@@ -159,10 +159,6 @@
}
return gotLock;
-#else // WIN32
- // no housekeeping process, we do have the lock
- return true;
-#endif // !WIN32
}
@@ -459,9 +455,9 @@
{
// Open it twice
#ifdef WIN32
- FileStream diff(tempFn.c_str(),
+ InvisibleTempFileStream diff(tempFn.c_str(),
O_RDWR | O_CREAT | O_BINARY);
- FileStream diff2(tempFn.c_str(),
+ InvisibleTempFileStream diff2(tempFn.c_str(),
O_RDWR | O_BINARY);
#else
FileStream diff(tempFn.c_str(), O_RDWR | O_CREAT | O_EXCL);
@@ -521,14 +517,6 @@
::unlink(tempFn.c_str());
throw;
}
-
-#ifdef WIN32
- // we can't delete the file while it's open, above
- if(::unlink(tempFn.c_str()) != 0)
- {
- THROW_EXCEPTION(CommonException, OSFileError);
- }
-#endif
}
// Get the blocks used
More information about the Boxbackup-commit
mailing list