Skip to content

Commit 838ebbe

Browse files
committed
Add truncate behavior to marker file creation
This commit ensures that .truncate(true) is set when creating marker files to clarify that existing files should be overwritten. This is unlikely to happen with the temp directory file format containing the PID and TID, but if it were to happen, it's better to be safe than sorry. This also fixes the clippy::suspicious_open_options warning.
1 parent 587375b commit 838ebbe

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

samply-markers/src/provider/unix.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ fn create_marker_file() -> Option<File> {
9393

9494
let file = File::options()
9595
.create(true)
96+
.truncate(true)
9697
.write(true)
9798
.read({
9899
// We aren't going to read from the file, so we ordinarily

0 commit comments

Comments
 (0)