summaryrefslogtreecommitdiff
path: root/bin/bbstored/BackupCommands.cpp
diff options
context:
space:
mode:
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(...)
{