summaryrefslogtreecommitdiff
path: root/lib/Bytecode/Archive/ArchiveWriter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Bytecode/Archive/ArchiveWriter.cpp')
-rw-r--r--lib/Bytecode/Archive/ArchiveWriter.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Bytecode/Archive/ArchiveWriter.cpp b/lib/Bytecode/Archive/ArchiveWriter.cpp
index 87816651d73..390fd128512 100644
--- a/lib/Bytecode/Archive/ArchiveWriter.cpp
+++ b/lib/Bytecode/Archive/ArchiveWriter.cpp
@@ -463,7 +463,12 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress,
// compatibility with other ar(1) implementations as well as allowing the
// archive to store both native .o and LLVM .bc files, both indexed.
if (foreignST) {
- writeMember(*foreignST, FinalFile, false, false, false);
+ if (!writeMember(*foreignST, FinalFile, false, false, false, error)) {
+ FinalFile.close();
+ if (TmpArchive.exists())
+ TmpArchive.eraseFromDisk();
+ return false;
+ }
}
// Put out the LLVM symbol table now.