summaryrefslogtreecommitdiff
path: root/bin/bbstored/BackupCommands.cpp
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2006-10-13 23:03:23 +0000
committerChris Wilson <chris+github@qwirx.com>2006-10-13 23:03:23 +0000
commit9635631135e1f0df36a0b038f047384dd9d8c8c0 (patch)
tree23c91d2ea5ba5b6e00c853bdff67cd222f7c6768 /bin/bbstored/BackupCommands.cpp
parentf1ae01e66e6d2ed9072d17943fb04ccea0dbe592 (diff)
* Added support for Win32 temporary files
* Added InvisibleTempFileStream class and unit tests for it * Use InvisibleTempFileStream instead of FileStream for temporary files (refs #3)
Diffstat (limited to 'bin/bbstored/BackupCommands.cpp')
-rw-r--r--bin/bbstored/BackupCommands.cpp22
1 files changed, 7 insertions, 15 deletions
diff --git a/bin/bbstored/BackupCommands.cpp b/bin/bbstored/BackupCommands.cpp
index 60a660d1..cf8025e4 100644
--- a/bin/bbstored/BackupCommands.cpp
+++ b/bin/bbstored/BackupCommands.cpp
@@ -29,6 +29,7 @@
#include "BackupStoreInfo.h"
#include "RaidFileController.h"
#include "FileStream.h"
+#include "InvisibleTempFileStream.h"
#include "MemLeakFindOn.h"
@@ -344,23 +345,14 @@ std::auto_ptr<ProtocolObject> BackupProtocolServerGetFile::DoCommand(BackupProto
{
{
// Write nastily to allow this to work with gcc 2.x
-#ifdef WIN32
- combined.reset(new FileStream(
- tempFn.c_str(),
- O_RDWR | O_CREAT | O_EXCL |
- O_BINARY | O_TRUNC));
-#else
- std::auto_ptr<IOStream> t(new FileStream(tempFn.c_str(), O_RDWR | O_CREAT | O_EXCL));
+ std::auto_ptr<IOStream> t(
+ new InvisibleTempFileStream(
+ tempFn.c_str(),
+ O_RDWR | O_CREAT |
+ O_EXCL | O_BINARY |
+ O_TRUNC));
combined = t;
-#endif
- }
-#ifndef WIN32
- // Unlink immediately as it's a temporary file
- if(::unlink(tempFn.c_str()) != 0)
- {
- THROW_EXCEPTION(CommonException, OSFileError);
}
-#endif
}
catch(...)
{