From 811429bfd4a46f33c7788580f72038b0c3c1c2b1 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Mon, 10 Jun 2024 20:31:03 +0000 Subject: wayland: consistently check mmap error after 6967a3145044 (#6402) mmap() returns MAP_FAILED on error, not nullptr. --- src/protocols/core/Shm.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/protocols/core/Shm.cpp') diff --git a/src/protocols/core/Shm.cpp b/src/protocols/core/Shm.cpp index ce7d3a61..4088949f 100644 --- a/src/protocols/core/Shm.cpp +++ b/src/protocols/core/Shm.cpp @@ -97,7 +97,7 @@ void CSHMPool::resize(size_t size_) { size = size_; data = mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (!data) + if (data == MAP_FAILED) LOGM(ERR, "Couldn't mmap {} bytes from fd {} of shm client", size, fd); } @@ -146,7 +146,7 @@ CWLSHMPoolResource::CWLSHMPoolResource(SP resource_, int fd_, size_t RESOURCE->resource->buffer = RESOURCE; }); - if (!pool->data) + if (pool->data == MAP_FAILED) resource->error(WL_SHM_ERROR_INVALID_FD, "Couldn't mmap from fd"); } -- cgit v1.2.3