Use MAP_FAILED instead of (void *) -1

While MAP_FAILED is generally defined to that value, we should not be
relying on implementation details of system headers.

Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
Reviewed-by: Simon Ser <contact@emersion.fr>
This commit is contained in:
Alex Richardson 2021-03-19 11:24:05 +00:00
parent 3bda3d1b47
commit 1349d3d15b

View File

@ -511,10 +511,8 @@ sigbus_handler(int signum, siginfo_t *info, void *context)
sigbus_data->fallback_mapping_used = 1;
/* This should replace the previous mapping */
if (mmap(pool->data, pool->size,
PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOUS,
0, 0) == (void *) -1) {
if (mmap(pool->data, pool->size, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOUS, 0, 0) == MAP_FAILED) {
reraise_sigbus();
return;
}