summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartijn Coenen <maco@google.com>2017-02-22 09:25:31 +0100
committerMartijn Coenen <maco@google.com>2017-02-22 09:25:31 +0100
commitc579198835539100087ba71f5bbf38c3c09422e6 (patch)
treeb28655d220d1889cae4ca3c9f7cfc049e18062a3
parent6481ebfbc36c7ef3d7e6e4809e802240eb0da297 (diff)
downloadnative-c579198835539100087ba71f5bbf38c3c09422e6.tar.gz
Truncate trace output files.
To avoid creating trace files with garbage at the end. Bug: 35588070 Test: atrace runs Change-Id: I26ef4c652ca2e2dd8ff9d11d4f380b44791cb960
-rw-r--r--cmds/atrace/atrace.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/cmds/atrace/atrace.cpp b/cmds/atrace/atrace.cpp
index a6cde79849..965a78e0b3 100644
--- a/cmds/atrace/atrace.cpp
+++ b/cmds/atrace/atrace.cpp
@@ -1239,7 +1239,7 @@ int main(int argc, char **argv)
fflush(stdout);
int outFd = STDOUT_FILENO;
if (g_outputFile) {
- outFd = open(g_outputFile, O_WRONLY | O_CREAT, 0644);
+ outFd = open(g_outputFile, O_WRONLY | O_CREAT | O_TRUNC, 0644);
}
if (outFd == -1) {
printf("Failed to open '%s', err=%d", g_outputFile, errno);