Merge pull request #2010 from whitequark/fix-windows-creat_trunc

WASI: make O_CREAT|O_TRUNC actually truncate files on Windows
This commit is contained in:
Peter Huene
2020-07-11 17:11:22 -07:00
committed by GitHub
4 changed files with 99 additions and 16 deletions

View File

@@ -224,7 +224,7 @@ pub(crate) fn open(
let mut opts = OpenOptions::new();
match oflags.into() {
CreationDisposition::CREATE_ALWAYS => {
opts.create(true).write(true);
opts.create(true).truncate(true).write(true);
}
CreationDisposition::CREATE_NEW => {
opts.create_new(true).write(true);