summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2006-10-15 19:49:11 +0000
committerChris Wilson <chris+github@qwirx.com>2006-10-15 19:49:11 +0000
commite3273ee1e61dc94baa733aeba533af886717142a (patch)
treee541de90f248c4553f43cdbed991b44c59766219 /bin
parent33642449e8ba850deed990d95c0a4e542ebcee99 (diff)
Revert patch [862] (refs #3)
Diffstat (limited to 'bin')
-rw-r--r--bin/bbstored/BackupContext.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/bin/bbstored/BackupContext.cpp b/bin/bbstored/BackupContext.cpp
index d78ed9b1..a3f614a5 100644
--- a/bin/bbstored/BackupContext.cpp
+++ b/bin/bbstored/BackupContext.cpp
@@ -125,6 +125,7 @@ void BackupContext::ReceivedFinishCommand()
// --------------------------------------------------------------------------
bool BackupContext::AttemptToGetWriteLock()
{
+#ifndef WIN32
// Make the filename of the write lock file
std::string writeLockFile;
StoreStructure::MakeWriteLockFilename(mStoreRoot, mStoreDiscSet, writeLockFile);
@@ -158,6 +159,10 @@ bool BackupContext::AttemptToGetWriteLock()
}
return gotLock;
+#else // WIN32
+ // no housekeeping process, we do have the lock
+ return true;
+#endif // !WIN32
}
@@ -461,6 +466,12 @@ int64_t BackupContext::AddFile(IOStream &rFile, int64_t InDirectory, int64_t Mod
#else
FileStream diff(tempFn.c_str(), O_RDWR | O_CREAT | O_EXCL);
FileStream diff2(tempFn.c_str(), O_RDONLY);
+
+ // Unlink it immediately, so it definitely goes away
+ if(::unlink(tempFn.c_str()) != 0)
+ {
+ THROW_EXCEPTION(CommonException, OSFileError);
+ }
#endif
// Stream the incoming diff to this temporary file
@@ -503,14 +514,6 @@ int64_t BackupContext::AddFile(IOStream &rFile, int64_t InDirectory, int64_t Mod
spaceAdjustFromDiff = from->GetDiscUsageInBlocks() - oldVersionNewBlocksUsed;
// Everything cleans up here...
- diff.Close();
- diff2.Close();
-
- // Unlink the temporary file
- if(::unlink(tempFn.c_str()) != 0)
- {
- THROW_EXCEPTION(CommonException, OSFileError);
- }
}
catch(...)
{