summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2006-08-30 14:02:30 +0000
committerChris Wilson <chris+github@qwirx.com>2006-08-30 14:02:30 +0000
commit6932579c38836aaec62ede8cd77bf66bb2e82d11 (patch)
treec9dfb3fd9e8d8a2ca77d7ec64b2a90372ff57248 /bin
parent38c55c8f335756d710a06dc0f604a5f6d600f07e (diff)
* bin/bbstored/BackupCommands.cpp
- Revert to trunk
Diffstat (limited to 'bin')
-rw-r--r--bin/bbstored/BackupCommands.cpp33
1 files changed, 4 insertions, 29 deletions
diff --git a/bin/bbstored/BackupCommands.cpp b/bin/bbstored/BackupCommands.cpp
index 845903b2..35bc095d 100644
--- a/bin/bbstored/BackupCommands.cpp
+++ b/bin/bbstored/BackupCommands.cpp
@@ -9,12 +9,7 @@
#include "Box.h"
-#ifdef HAVE_SYSLOG_H
#include <syslog.h>
-#endif
-
-#include <set>
-#include <sstream>
#include "autogen_BackupProtocolServer.h"
#include "BackupConstants.h"
@@ -332,15 +327,8 @@ std::auto_ptr<ProtocolObject> BackupProtocolServerGetFile::DoCommand(BackupProto
std::auto_ptr<IOStream> diff2(rContext.OpenObject(patchID));
// Choose a temporary filename for the result of the combination
-#ifdef WIN32
- std::ostringstream fs(rContext.GetStoreRoot());
- fs << ".recombinetemp.";
- fs << p;
- std::string tempFn(fs.str());
- tempFn = RaidFileController::DiscSetPathToFileSystemPath(rContext.GetStoreDiscSet(), tempFn, p + 16);
-#else
- std::string tempFn(RaidFileController::DiscSetPathToFileSystemPath(rContext.GetStoreDiscSet(), rContext.GetStoreRoot() + ".recombinetemp", p + 16 /* rotate which disc it's on */));
-#endif
+ std::string tempFn(RaidFileController::DiscSetPathToFileSystemPath(rContext.GetStoreDiscSet(), rContext.GetStoreRoot() + ".recombinetemp",
+ p + 16 /* rotate which disc it's on */));
// Open the temporary file
std::auto_ptr<IOStream> combined;
@@ -348,23 +336,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));
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(...)
{
@@ -380,9 +359,6 @@ std::auto_ptr<ProtocolObject> BackupProtocolServerGetFile::DoCommand(BackupProto
combined->Seek(0, IOStream::SeekType_Absolute);
// Then shuffle round for the next go
-#ifdef WIN32
- if (from.get()) from->Close();
-#endif
from = combined;
}
@@ -420,9 +396,8 @@ std::auto_ptr<ProtocolObject> BackupProtocolServerGetFile::DoCommand(BackupProto
stream = t;
}
- // Object will be deleted when the stream is deleted,
- // so can release the object auto_ptr here to avoid
- // premature deletion
+ // Object will be deleted when the stream is deleted, so can release the object auto_ptr here to
+ // avoid premature deletiong
object.release();
}