Add flock(2)ing on dex-cache files to prevent races
Bug: 9071417
Change-Id: I1ee9ff281867f90fba7a8ed8bbf06b33ac29d511
diff --git a/runtime/trace.cc b/runtime/trace.cc
index 29765c9..13e2bf6 100644
--- a/runtime/trace.cc
+++ b/runtime/trace.cc
@@ -318,7 +318,7 @@
UniquePtr<File> trace_file;
if (!direct_to_ddms) {
if (trace_fd < 0) {
- trace_file.reset(OS::OpenFile(trace_filename, true));
+ trace_file.reset(OS::CreateEmptyFile(trace_filename));
} else {
trace_file.reset(new File(trace_fd, "tracefile"));
trace_file->DisableAutoClose();