Index: runtime/bin/file_macos.cc |
diff --git a/runtime/bin/file_macos.cc b/runtime/bin/file_macos.cc |
index 586a9e40bb57d55fc338f97be603d100ed4491f7..25387bdac03fe94d174c70aa5ac4a68625138547 100644 |
--- a/runtime/bin/file_macos.cc |
+++ b/runtime/bin/file_macos.cc |
@@ -104,10 +104,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; |
- if (writable) { |
- flags = (O_RDWR | O_CREAT | O_TRUNC); |
+ if ((mode & kWrite) != 0) { |
+ flags = (O_RDWR | O_CREAT); |
+ } |
+ if ((mode & kTruncate) != 0) { |
+ flags = flags | O_TRUNC; |
} |
int fd = open(name, flags, 0666); |
if (fd < 0) { |