Fix broken error check in Parcel::readBlob

mmap returns MAP_FAILED (which is -1) and not NULL on
failure.

Diagnosed by cferris.

bug: 17909809

Change-Id: I609788ebf94742ef88af002d2d3f3bc9b9e520ac
This commit is contained in:
Narayan Kamath 2014-10-08 17:35:45 +01:00
parent 7830ef3dd0
commit 9ea09757fa

View File

@ -1281,7 +1281,7 @@ status_t Parcel::readBlob(size_t len, ReadableBlob* outBlob) const
if (fd == int(BAD_TYPE)) return BAD_VALUE;
void* ptr = ::mmap(NULL, len, PROT_READ, MAP_SHARED, fd, 0);
if (!ptr) return NO_MEMORY;
if (ptr == MAP_FAILED) return NO_MEMORY;
outBlob->init(true /*mapped*/, ptr, len);
return NO_ERROR;