summaryrefslogtreecommitdiff
path: root/lib/Archive/ArchiveWriter.cpp
diff options
context:
space:
mode:
authorJeff Cohen <jeffc@jolt-lang.org>2005-01-22 17:36:17 +0000
committerJeff Cohen <jeffc@jolt-lang.org>2005-01-22 17:36:17 +0000
commit5fb6ed4ae608c6f7ef589f1069b5dd5c7bdbd60b (patch)
tree1a699df0388afa1ed3d3acc4e4cd91085adbed10 /lib/Archive/ArchiveWriter.cpp
parent695c9bdbd0ad9d540dea68e201cd616afb4320d4 (diff)
Use binary mode for reading/writing bytecode files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19751 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Archive/ArchiveWriter.cpp')
-rw-r--r--lib/Archive/ArchiveWriter.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Archive/ArchiveWriter.cpp b/lib/Archive/ArchiveWriter.cpp
index 5c7b1263204..f16376725d0 100644
--- a/lib/Archive/ArchiveWriter.cpp
+++ b/lib/Archive/ArchiveWriter.cpp
@@ -375,7 +375,9 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress){
// Ensure we can remove the temporary even in the face of an exception
try {
// Create archive file for output.
- std::ofstream ArchiveFile(TmpArchive.c_str());
+ std::ios::openmode io_mode = std::ios::out | std::ios::trunc |
+ std::ios::binary;
+ std::ofstream ArchiveFile(TmpArchive.c_str(), io_mode);
// Check for errors opening or creating archive file.
if ( !ArchiveFile.is_open() || ArchiveFile.bad() ) {
@@ -413,7 +415,7 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress){
const char* base = (const char*) arch.map();
// Open the final file to write and check it.
- std::ofstream FinalFile(archPath.c_str());
+ std::ofstream FinalFile(archPath.c_str(), io_mode);
if ( !FinalFile.is_open() || FinalFile.bad() ) {
throw std::string("Error opening archive file: ") + archPath.toString();
}