about summary refs log tree commit diff
path: root/src/libnative
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-04-30 11:37:01 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-04-30 11:37:01 -0700
commit8375a22b16ae6d746ccfd1f725a26562f55a82ba (patch)
tree6feb1937e652a1c0a0b58529be35c06c976a22b7 /src/libnative
parent7e9f3ea42361a5a938a4f22beff28bb2ade48af4 (diff)
downloadrust-8375a22b16ae6d746ccfd1f725a26562f55a82ba.tar.gz
rust-8375a22b16ae6d746ccfd1f725a26562f55a82ba.zip
native: Always open a file with Open/Write modes
Previously, windows was using the CREATE_NEW flag which fails if the file
previously existed, which differed from the unix semantics. This alters the
opening to use the OPEN_ALWAYS flag to mirror the unix semantics.

Closes #13861
Diffstat (limited to 'src/libnative')
-rw-r--r--src/libnative/io/file_win32.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libnative/io/file_win32.rs b/src/libnative/io/file_win32.rs
index de515659bf7..f85c6b7380b 100644
--- a/src/libnative/io/file_win32.rs
+++ b/src/libnative/io/file_win32.rs
@@ -274,7 +274,7 @@ pub fn open(path: &CString, fm: io::FileMode, fa: io::FileAccess)
         (io::Truncate, io::Read) => libc::TRUNCATE_EXISTING,
         (io::Truncate, _) => libc::CREATE_ALWAYS,
         (io::Open, io::Read) => libc::OPEN_EXISTING,
-        (io::Open, _) => libc::CREATE_NEW,
+        (io::Open, _) => libc::OPEN_ALWAYS,
         (io::Append, io::Read) => {
             dwDesiredAccess |= libc::FILE_APPEND_DATA;
             libc::OPEN_EXISTING