File tree 1 file changed +3
-0
lines changed
compiler/rustc_codegen_ssa/src/back
1 file changed +3
-0
lines changed Original file line number Diff line number Diff line change @@ -493,6 +493,7 @@ impl<'a> ArArchiveBuilder<'a> {
493
493
perms : 0o644 ,
494
494
} )
495
495
}
496
+
496
497
// Write to a temporary file first before atomically renaming to the final name.
497
498
// This prevents programs (including rustc) from attempting to read a partial archive.
498
499
// It also enables writing an archive with the same filename as a dependency on Windows as
@@ -510,6 +511,7 @@ impl<'a> ArArchiveBuilder<'a> {
510
511
let archive_tmpfile_path = archive_tmpdir. path ( ) . join ( "tmp.a" ) ;
511
512
let archive_tmpfile = File :: create_new ( & archive_tmpfile_path)
512
513
. map_err ( |err| io_error_context ( "couldn't create the temp file" , err) ) ?;
514
+
513
515
let mut archive_tmpfile = BufWriter :: new ( archive_tmpfile) ;
514
516
write_archive_to_stream (
515
517
& mut archive_tmpfile,
@@ -520,6 +522,7 @@ impl<'a> ArArchiveBuilder<'a> {
520
522
) ?;
521
523
archive_tmpfile. flush ( ) ?;
522
524
drop ( archive_tmpfile) ;
525
+
523
526
let any_entries = !entries. is_empty ( ) ;
524
527
drop ( entries) ;
525
528
// Drop src_archives to unmap all input archives, which is necessary if we want to write the
You can’t perform that action at this time.
0 commit comments