summaryrefslogtreecommitdiff
path: root/rts/Hpc.c
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-07-26 10:32:25 -0400
committerBen Gamari <ben@smart-cactus.org>2019-07-26 10:34:04 -0400
commitdde76af0af6ef75e2593d9135f432170b1c841dc (patch)
tree57cce4928fa40a44d76c3995c4cc440e4649cc19 /rts/Hpc.c
parentb9c99df1a4cdd23bcd26db7ae6ee7ee6464d654e (diff)
downloadhaskell-wip/T16993.tar.gz
rts: Always truncate output fileswip/T16993
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);
}