summaryrefslogtreecommitdiffstats
path: root/base/platform_file_posix.cc
diff options
context:
space:
mode:
authorericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-13 21:56:32 +0000
committerericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-13 21:56:32 +0000
commitd4905e2e68cb434f9b3cbea9726eeaf23b1ecb00 (patch)
tree0252099f7e9b2eaa1f0df3166da7933d761b4b55 /base/platform_file_posix.cc
parent067a16671a1faf2f460f5ebbddfbfb5d933c5cec (diff)
downloadchromium_src-d4905e2e68cb434f9b3cbea9726eeaf23b1ecb00.zip
chromium_src-d4905e2e68cb434f9b3cbea9726eeaf23b1ecb00.tar.gz
chromium_src-d4905e2e68cb434f9b3cbea9726eeaf23b1ecb00.tar.bz2
ObfuscatedFileSystemFileUtil class
This is functional and reasonably well-tested, but we'll still have to adapt the system a bit in order to use it. BUG=none TEST=included unit tests Review URL: http://codereview.chromium.org/6955013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85332 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/platform_file_posix.cc')
-rw-r--r--base/platform_file_posix.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/base/platform_file_posix.cc b/base/platform_file_posix.cc
index 6e2cff6..2ffac06 100644
--- a/base/platform_file_posix.cc
+++ b/base/platform_file_posix.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -36,6 +36,9 @@ PlatformFile CreatePlatformFile(const FilePath& name, int flags,
if (flags & PLATFORM_FILE_CREATE)
open_flags = O_CREAT | O_EXCL;
+ if (created)
+ *created = false;
+
if (flags & PLATFORM_FILE_CREATE_ALWAYS) {
DCHECK(!open_flags);
open_flags = O_CREAT | O_TRUNC;
@@ -70,10 +73,7 @@ PlatformFile CreatePlatformFile(const FilePath& name, int flags,
HANDLE_EINTR(open(name.value().c_str(), open_flags, S_IRUSR | S_IWUSR));
if (flags & PLATFORM_FILE_OPEN_ALWAYS) {
- if (descriptor > 0) {
- if (created)
- *created = false;
- } else {
+ if (descriptor <= 0) {
open_flags |= O_CREAT;
if (flags & PLATFORM_FILE_EXCLUSIVE_READ ||
flags & PLATFORM_FILE_EXCLUSIVE_WRITE) {