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 = |