Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(517)

Unified Diff: runtime/bin/file_macos.cc

Issue 9034005: Change the behavior of open on files to not truncate by default (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comment.s Created 8 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/file_linux.cc ('k') | runtime/bin/file_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « runtime/bin/file_linux.cc ('k') | runtime/bin/file_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698