| Index: runtime/bin/file_win.cc
|
| diff --git a/runtime/bin/file_win.cc b/runtime/bin/file_win.cc
|
| index 67b97f51af1698240c70f839c7235728c0382a68..0fde433603853cb7cd4533d4223065729de6dd23 100644
|
| --- a/runtime/bin/file_win.cc
|
| +++ b/runtime/bin/file_win.cc
|
| @@ -157,8 +157,13 @@ int64_t File::Length() {
|
| File* File::Open(const char* name, FileOpenMode mode) {
|
| int flags = O_RDONLY | O_BINARY | O_NOINHERIT;
|
| if ((mode & kWrite) != 0) {
|
| + ASSERT((mode & kWriteOnly) == 0);
|
| flags = (O_RDWR | O_CREAT | O_BINARY | O_NOINHERIT);
|
| }
|
| + if ((mode & kWriteOnly) != 0) {
|
| + ASSERT((mode & kWrite) == 0);
|
| + flags = (O_WRONLY | O_CREAT | O_BINARY | O_NOINHERIT);
|
| + }
|
| if ((mode & kTruncate) != 0) {
|
| flags = flags | O_TRUNC;
|
| }
|
| @@ -168,7 +173,8 @@ File* File::Open(const char* name, FileOpenMode mode) {
|
| if (fd < 0) {
|
| return NULL;
|
| }
|
| - if (((mode & kWrite) != 0) && ((mode & kTruncate) == 0)) {
|
| + if ((((mode & kWrite) != 0) && ((mode & kTruncate) == 0)) ||
|
| + (((mode & kWriteOnly) != 0) && ((mode & kTruncate) == 0))) {
|
| int64_t position = _lseeki64(fd, 0, SEEK_END);
|
| if (position < 0) {
|
| return NULL;
|
|
|