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

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: Make changes according to Darin's suggestions. 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
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 =

Powered by Google App Engine
This is Rietveld 408576698