summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-29 17:01:22 +0000
committerbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-29 17:01:22 +0000
commitf7dadf7909952ea3c5fd8e0393209694bbb5ec50 (patch)
tree44908ceb5aea62078a45dc11eeeaec87dbd3c536
parent4b6c20f75f61faf4cc50bc332a17afbfb1b4d6f4 (diff)
downloadchromium_src-f7dadf7909952ea3c5fd8e0393209694bbb5ec50.zip
chromium_src-f7dadf7909952ea3c5fd8e0393209694bbb5ec50.tar.gz
chromium_src-f7dadf7909952ea3c5fd8e0393209694bbb5ec50.tar.bz2
Removed magic number for owner rights, avoid to call close(-1).
Patch committed for mendola@gmail.com git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4128 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/shared_memory_posix.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/base/shared_memory_posix.cc b/base/shared_memory_posix.cc
index 82e4f60..3e6d9eb 100644
--- a/base/shared_memory_posix.cc
+++ b/base/shared_memory_posix.cc
@@ -82,7 +82,7 @@ bool SharedMemory::CreateOrOpen(const std::wstring &name, int posix_flags) {
name_ = L"/" + name;
- int posix_mode = 0600; // owner read/write
+ mode_t posix_mode = S_IRUSR | S_IWUSR; // owner read/write
std::string posix_name(WideToUTF8(name_));
mapped_file_ = shm_open(posix_name.c_str(), posix_flags, posix_mode);
if (mapped_file_ < 0)
@@ -143,7 +143,7 @@ void SharedMemory::Close() {
}
std::string posix_name(WideToUTF8(name_));
- if (mapped_file_) {
+ if (mapped_file_ > 0) {
close(mapped_file_);
shm_unlink(posix_name.c_str());
mapped_file_ = -1;