Add kTruncate in FileBase. BUG=6841435.
And remove O_TRUNC from the default flags to OutputFile.
Change-Id: Id2ff6d5bac319d8be498e438eb3ef84e85573218
diff --git a/lib/RenderScript/RSCompilerDriver.cpp b/lib/RenderScript/RSCompilerDriver.cpp
index a59a7f9..60a6d9d 100644
--- a/lib/RenderScript/RSCompilerDriver.cpp
+++ b/lib/RenderScript/RSCompilerDriver.cpp
@@ -228,7 +228,8 @@
//===--------------------------------------------------------------------===//
// Open the output file for write.
//===--------------------------------------------------------------------===//
- OutputFile *output_file = new (std::nothrow) OutputFile(pOutputPath);
+ OutputFile *output_file =
+ new (std::nothrow) OutputFile(pOutputPath, FileBase::kTruncate);
if ((output_file == NULL) || output_file->hasError()) {
ALOGE("Unable to open the %s for write! (%s)", pOutputPath,
diff --git a/lib/RenderScript/RSExecutable.cpp b/lib/RenderScript/RSExecutable.cpp
index bbb31db..e18167a 100644
--- a/lib/RenderScript/RSExecutable.cpp
+++ b/lib/RenderScript/RSExecutable.cpp
@@ -128,7 +128,7 @@
}
android::String8 info_path = RSInfo::GetPath(*mObjFile);
- OutputFile info_file(info_path.string());
+ OutputFile info_file(info_path.string(), FileBase::kTruncate);
if (info_file.hasError()) {
ALOGE("Failed to open the info file %s for write! (%s)", info_path.string(),