[Support][FileSystem] Fix open mode in resize_file on Windows.
authorMichael J. Spencer <bigcheesegs@gmail.com>
Mon, 3 Dec 2012 22:09:31 +0000 (22:09 +0000)
committerMichael J. Spencer <bigcheesegs@gmail.com>
Mon, 3 Dec 2012 22:09:31 +0000 (22:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169166 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/Windows/PathV2.inc

index c7ef8278a224bb7bdfc89a986e9bd4f22ff1fca4..2e6cc96e7f141dbea2051761d30d48e42f3c3fb0 100644 (file)
@@ -328,7 +328,7 @@ error_code resize_file(const Twine &path, uint64_t size) {
                                   path_utf16))
     return ec;
 
-  int fd = ::_wopen(path_utf16.begin(), O_BINARY, S_IREAD | S_IWRITE);
+  int fd = ::_wopen(path_utf16.begin(), O_BINARY | _O_RDWR, S_IWRITE);
   if (fd == -1)
     return error_code(errno, generic_category());
 #ifdef HAVE__CHSIZE_S