summaryrefslogtreecommitdiff
path: root/src/protocols/core/Shm.cpp
diff options
context:
space:
mode:
authorJan Beich <jbeich@FreeBSD.org>2024-06-10 20:31:03 +0000
committerGitHub <noreply@github.com>2024-06-10 22:31:03 +0200
commit811429bfd4a46f33c7788580f72038b0c3c1c2b1 (patch)
tree95e78563c6a83fc4afa2aacea08edc02872434dd /src/protocols/core/Shm.cpp
parentea2501d4556f84d3de86a4ae2f4b22a474555b9f (diff)
wayland: consistently check mmap error after 6967a3145044 (#6402)
mmap() returns MAP_FAILED on error, not nullptr.
Diffstat (limited to 'src/protocols/core/Shm.cpp')
-rw-r--r--src/protocols/core/Shm.cpp4
1 files changed, 2 insertions, 2 deletions
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<CWlShmPool> 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");
}