summaryrefslogtreecommitdiff
path: root/rts/Hpc.c
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-07-26 10:32:25 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-08-02 22:20:50 -0400
commit4664bafcb8db9f7cbcc9d16b0b1d381650b682c2 (patch)
tree5a0e87b51c6a8e5d730953df94765c6e23cb803c /rts/Hpc.c
parent0ecacb1ee6d353f85b83a63941b6e26f1ff9f4db (diff)
downloadhaskell-4664bafcb8db9f7cbcc9d16b0b1d381650b682c2.tar.gz
rts: Always truncate output files
Previously there were numerous places in the RTS where we would fopen with the "w" flag string. This is wrong as it will not truncate the file. Consequently if we write less data than the previous length of the file we will leave garbage at its end. Fixes #16993.
Diffstat (limited to 'rts/Hpc.c')
-rw-r--r--rts/Hpc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/rts/Hpc.c b/rts/Hpc.c
index 9ba9b04b61..abf85430ac 100644
--- a/rts/Hpc.c
+++ b/rts/Hpc.c
@@ -388,7 +388,7 @@ exitHpc(void) {
// not clober the .tix file.
if (hpc_pid == getpid()) {
- FILE *f = __rts_fopen(tixFilename,"w");
+ FILE *f = __rts_fopen(tixFilename,"w+");
writeTix(f);
}