about summary refs log tree commit diff
diff options
context:
space:
mode:
authornabijaczleweli <nabijaczleweli@gmail.com>2018-03-31 19:12:29 +0200
committernabijaczleweli <nabijaczleweli@gmail.com>2018-03-31 19:12:29 +0200
commite1d3c471d75bbc4360eee17178ccb32dce348542 (patch)
treea7bfd3cd5565b4da4793b5a82a0f24cb7107b123
parent3787106be6e3a9be377aecc8600a2e57aa1afb58 (diff)
downloadrust-e1d3c471d75bbc4360eee17178ccb32dce348542.tar.gz
rust-e1d3c471d75bbc4360eee17178ccb32dce348542.zip
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
-rw-r--r--src/librustc_trans/back/link.rs2
1 files changed, 1 insertions, 1 deletions
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()?;
                 }
             }