Merge "Judge mmap failed by MAP_FAILED instead of NULL"
This commit is contained in:
commit
48ac3d1b14
2 changed files with 2 additions and 2 deletions
|
|
@ -55,7 +55,7 @@ int transport_handle_download(struct transport_handle *thandle, size_t len)
|
||||||
ftruncate(fd, len);
|
ftruncate(fd, len);
|
||||||
|
|
||||||
buffer = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
buffer = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||||
if (buffer == NULL) {
|
if (buffer == MAP_FAILED) {
|
||||||
D(ERR, "mmap(%zu) failed: %d %s", len, errno, strerror(errno));
|
D(ERR, "mmap(%zu) failed: %d %s", len, errno, strerror(errno));
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ static mspace getMspace()
|
||||||
gExecutableStore = mmap(NULL, kMaxCodeCacheCapacity,
|
gExecutableStore = mmap(NULL, kMaxCodeCacheCapacity,
|
||||||
PROT_READ | PROT_WRITE | PROT_EXEC,
|
PROT_READ | PROT_WRITE | PROT_EXEC,
|
||||||
MAP_PRIVATE, fd, 0);
|
MAP_PRIVATE, fd, 0);
|
||||||
LOG_ALWAYS_FATAL_IF(gExecutableStore == NULL,
|
LOG_ALWAYS_FATAL_IF(gExecutableStore == MAP_FAILED,
|
||||||
"Creating code cache, mmap failed with error "
|
"Creating code cache, mmap failed with error "
|
||||||
"'%s'", strerror(errno));
|
"'%s'", strerror(errno));
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue