From e1d3c471d75bbc4360eee17178ccb32dce348542 Mon Sep 17 00:00:00 2001 From: nabijaczleweli Date: Sat, 31 Mar 2018 19:12:29 +0200 Subject: [PATCH] Open the file as write before trying to flush it This should be enough and shouldn't require append(true) since we're not explicitly writing anything so we're not flushing it so we've no risk of overwriting it --- src/librustc_trans/back/link.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs index 46defb9e733..5da4667af91 100644 --- a/src/librustc_trans/back/link.rs +++ b/src/librustc_trans/back/link.rs @@ -894,7 +894,7 @@ fn exec_linker(sess: &Session, cmd: &mut Command, out_filename: &Path, tmpdir: & if let &Ok(ref out) = command_output { if out.status.success() { - if let Ok(of) = fs::File::open(out_filename) { + if let Ok(of) = fs::OpenOptions::new().write(true).open(out_filename) { of.sync_all()?; } }