From 1349d3d15bf7d100d0eae52d976a121d2dcf32ce Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Fri, 19 Mar 2021 11:24:05 +0000 Subject: [PATCH] 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 Reviewed-by: Simon Ser --- src/wayland-shm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/wayland-shm.c b/src/wayland-shm.c index b85e5a79..7320bc99 100644 --- a/src/wayland-shm.c +++ b/src/wayland-shm.c @@ -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; }