[Box Backup-commit] COMMIT r1041 - box/chris/general/bin/bbstored
boxbackup-dev@fluffy.co.uk
boxbackup-dev@fluffy.co.uk
Sun, 15 Oct 2006 14:46:51 +0100
Author: chris
Date: 2006-10-15 14:46:51 +0100 (Sun, 15 Oct 2006)
New Revision: 1041
Modified:
box/chris/general/bin/bbstored/BackupContext.cpp
Log:
Don't disable lock waiting loop on Win32 (even though it does nothing and
is never called right now)
Use InvisibleTempFileStream for temporary files on Windows, rather than
deleting them ourselves.
Modified: box/chris/general/bin/bbstored/BackupContext.cpp
===================================================================
--- box/chris/general/bin/bbstored/BackupContext.cpp 2006-10-15 13:44:48 UTC (rev 1040)
+++ box/chris/general/bin/bbstored/BackupContext.cpp 2006-10-15 13:46:51 UTC (rev 1041)
@@ -24,6 +24,7 @@
#include "BackupStoreDaemon.h"
#include "RaidFileController.h"
#include "FileStream.h"
+#include "InvisibleTempFileStream.h"
#include "MemLeakFindOn.h"
@@ -132,7 +133,6 @@
// Request the lock
bool gotLock = mWriteLock.TryAndGetLock(writeLockFile.c_str(), 0600 /* restrictive file permissions */);
-#ifndef WIN32
if(!gotLock)
{
// The housekeeping process might have the thing open -- ask it to stop
@@ -151,7 +151,6 @@
} while(!gotLock && tries > 0);
}
-#endif
if(gotLock)
{
@@ -456,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);
@@ -518,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