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

Unified Diff: base/platform_file_posix.cc

Issue 7038032: Fix PP_FileOpenFlags_Dev handling: (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: . Created 9 years, 7 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 | « base/platform_file.h ('k') | base/platform_file_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/platform_file_posix.cc
diff --git a/base/platform_file_posix.cc b/base/platform_file_posix.cc
index 2ffac06456aac130f20622b0547319fec99bf3f1..a1388d6c3a426f462b46b57c39e521a6019272e4 100644
--- a/base/platform_file_posix.cc
+++ b/base/platform_file_posix.cc
@@ -44,6 +44,12 @@ PlatformFile CreatePlatformFile(const FilePath& name, int flags,
open_flags = O_CREAT | O_TRUNC;
}
+ if (flags & PLATFORM_FILE_OPEN_TRUNCATED) {
+ DCHECK(!open_flags);
+ DCHECK(flags & PLATFORM_FILE_WRITE);
+ open_flags = O_TRUNC;
+ }
+
if (!open_flags && !(flags & PLATFORM_FILE_OPEN) &&
!(flags & PLATFORM_FILE_OPEN_ALWAYS)) {
NOTREACHED();
@@ -62,11 +68,6 @@ PlatformFile CreatePlatformFile(const FilePath& name, int flags,
NOTREACHED();
}
- if (flags & PLATFORM_FILE_TRUNCATE) {
- DCHECK(flags & PLATFORM_FILE_WRITE);
- open_flags |= O_TRUNC;
- }
-
COMPILE_ASSERT(O_RDONLY == 0, O_RDONLY_must_equal_zero);
int descriptor =
« no previous file with comments | « base/platform_file.h ('k') | base/platform_file_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698