diff options
author | 2013-08-12 17:04:14 -0700 | |
---|---|---|
committer | 2013-08-15 10:33:53 -0700 | |
commit | 7571e8b761ebc2c923525e12ea9fcf07e62cb33e (patch) | |
tree | 5d90ecf4d0ba1a72b040a376f227df1ba9278889 /compiler/llvm/llvm_compilation_unit.cc | |
parent | 2e250c826b3c405d675017efe79e5db3651c9ee6 (diff) |
Add flock(2)ing on dex-cache files to prevent races
Bug: 9071417
Change-Id: I1ee9ff281867f90fba7a8ed8bbf06b33ac29d511
Diffstat (limited to 'compiler/llvm/llvm_compilation_unit.cc')
-rw-r--r-- | compiler/llvm/llvm_compilation_unit.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/llvm/llvm_compilation_unit.cc b/compiler/llvm/llvm_compilation_unit.cc index 7542b841a1..139100bee9 100644 --- a/compiler/llvm/llvm_compilation_unit.cc +++ b/compiler/llvm/llvm_compilation_unit.cc @@ -155,7 +155,7 @@ void LlvmCompilationUnit::DumpBitcodeToFile() { std::string bitcode; DumpBitcodeToString(bitcode); std::string filename(StringPrintf("%s/Art%u.bc", DumpDirectory().c_str(), cunit_id_)); - UniquePtr<File> output(OS::OpenFile(filename.c_str(), true)); + UniquePtr<File> output(OS::CreateEmptyFile(filename.c_str())); output->WriteFully(bitcode.data(), bitcode.size()); LOG(INFO) << ".bc file written successfully: " << filename; } @@ -182,7 +182,7 @@ bool LlvmCompilationUnit::Materialize() { if (kDumpELF) { // Dump the ELF image for debugging std::string filename(StringPrintf("%s/Art%u.o", DumpDirectory().c_str(), cunit_id_)); - UniquePtr<File> output(OS::OpenFile(filename.c_str(), true)); + UniquePtr<File> output(OS::CreateEmptyFile(filename.c_str())); output->WriteFully(elf_object_.data(), elf_object_.size()); LOG(INFO) << ".o file written successfully: " << filename; } |