Bug 1538045 - use MAP_FAILED instead of (void*)-1 in shared_memory_posix.cc. r=jld
authorCameron McCormack <cam@mcc.id.au>
Tue, 26 Mar 2019 22:06:18 +0000
changeset 466248 d5b5baea492ae20badf1a8d45189aeaa0ef0cc7d
parent 466247 cebb5fa563f96382ce4036ddd0f53168d9211006
child 466249 e959f59120b66320138e1c01329ffda458d55855
push id35762
push usercsabou@mozilla.com
push dateWed, 27 Mar 2019 04:44:00 +0000
treeherdermozilla-central@bc572aee49b6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjld
bugs1538045
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1538045 - use MAP_FAILED instead of (void*)-1 in shared_memory_posix.cc. r=jld Differential Revision: https://phabricator.services.mozilla.com/D24458
ipc/chromium/src/base/shared_memory_posix.cc
--- a/ipc/chromium/src/base/shared_memory_posix.cc
+++ b/ipc/chromium/src/base/shared_memory_posix.cc
@@ -160,17 +160,17 @@ bool SharedMemory::Map(size_t bytes, voi
   if (mapped_file_ == -1) return false;
 
   // Don't use MAP_FIXED when a fixed_address was specified, since that can
   // replace pages that are alread mapped at that address.
   memory_ =
       mmap(fixed_address, bytes, PROT_READ | (read_only_ ? 0 : PROT_WRITE),
            MAP_SHARED, mapped_file_, 0);
 
-  bool mmap_succeeded = (memory_ != (void*)-1);
+  bool mmap_succeeded = memory_ != MAP_FAILED;
 
   DCHECK(mmap_succeeded) << "Call to mmap failed, errno=" << errno;
 
   if (mmap_succeeded) {
     if (fixed_address && memory_ != fixed_address) {
       bool munmap_succeeded = munmap(memory_, bytes) == 0;
       DCHECK(munmap_succeeded) << "Call to munmap failed, errno=" << errno;
       memory_ = NULL;