diff options
author | dumi@chromium.org <dumi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-28 21:58:28 +0000 |
---|---|---|
committer | dumi@chromium.org <dumi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-28 21:58:28 +0000 |
commit | ee8d4c8656fc8a8723e91e44d05fba4027c77b66 (patch) | |
tree | 7ed5dd75b40690657edd1e41b1aa78a980fd43d2 /base/platform_file_posix.cc | |
parent | 0189bc72c90fab03afab623d0b2d8be3d35af3e7 (diff) | |
download | chromium_src-ee8d4c8656fc8a8723e91e44d05fba4027c77b66.zip chromium_src-ee8d4c8656fc8a8723e91e44d05fba4027c77b66.tar.gz chromium_src-ee8d4c8656fc8a8723e91e44d05fba4027c77b66.tar.bz2 |
Chromium side patch for DB support on Linux.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/174232
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24807 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/platform_file_posix.cc')
-rw-r--r-- | base/platform_file_posix.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/base/platform_file_posix.cc b/base/platform_file_posix.cc index dd1c78d..f964c62 100644 --- a/base/platform_file_posix.cc +++ b/base/platform_file_posix.cc @@ -52,6 +52,10 @@ PlatformFile CreatePlatformFile(const std::wstring& name, *created = false; } else { open_flags |= O_CREAT; + if (flags & PLATFORM_FILE_EXCLUSIVE_READ || + flags & PLATFORM_FILE_EXCLUSIVE_WRITE) { + open_flags |= O_EXCL; // together with O_CREAT implies O_NOFOLLOW + } descriptor = open(WideToUTF8(name).c_str(), open_flags, S_IRUSR | S_IWUSR); if (created && descriptor > 0) @@ -59,7 +63,15 @@ PlatformFile CreatePlatformFile(const std::wstring& name, } } + if ((descriptor > 0) && (flags & PLATFORM_FILE_DELETE_ON_CLOSE)) { + unlink(WideToUTF8(name).c_str()); + } + return descriptor; } +bool ClosePlatformFile(PlatformFile file) { + return close(file); +} + } // namespace base |