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

Unified Diff: base/shared_memory_posix.cc

Issue 10174007: Fix shared_memory_posix Map() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/shared_memory_posix.cc
diff --git a/base/shared_memory_posix.cc b/base/shared_memory_posix.cc
index 34403c464c0f91f73c4e8602b94afecfbb39c473..1261d508d4275b7dbf099c8e0d951a87dfb37c97 100644
--- a/base/shared_memory_posix.cc
+++ b/base/shared_memory_posix.cc
@@ -239,11 +239,12 @@ bool SharedMemory::Map(uint32 bytes) {
memory_ = mmap(NULL, bytes, PROT_READ | (read_only_ ? 0 : PROT_WRITE),
MAP_SHARED, mapped_file_, 0);
- if (memory_)
+ bool mmap_succeeded = memory_ != (void*)-1 && memory_ != NULL;
+ if (mmap_succeeded)
mapped_size_ = bytes;
+ else
+ memory_ = NULL;
- bool mmap_succeeded = (memory_ != (void*)-1);
- DCHECK(mmap_succeeded) << "Call to mmap failed, errno=" << errno;
return mmap_succeeded;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698