Index: runtime/bin/file_win.cc |
diff --git a/runtime/bin/file_win.cc b/runtime/bin/file_win.cc |
index 8e4e3c14bcee9ddd4522ede070ca24165ff1745e..6d0522145d3c327f9267dc73188652b8c3781d05 100644 |
--- a/runtime/bin/file_win.cc |
+++ b/runtime/bin/file_win.cc |
@@ -100,10 +100,13 @@ off_t File::Length() { |
} |
-File* File::Open(const char* name, bool writable) { |
+File* File::Open(const char* name, FileOpenMode mode) { |
int flags = O_RDONLY | O_BINARY; |
- if (writable) { |
- flags = (O_RDWR | O_CREAT | O_TRUNC | O_BINARY); |
+ if ((mode & kWrite) != 0) { |
+ flags = (O_RDWR | O_CREAT | O_BINARY); |
+ } |
+ if ((mode & kTruncate) != 0) { |
+ flags = flags | O_TRUNC; |
} |
int fd = open(name, flags, 0666); |
if (fd < 0) { |