mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-22 21:49:49 +01:00
wayland: consistently check mmap error after 6967a31450
(#6402)
mmap() returns MAP_FAILED on error, not nullptr.
This commit is contained in:
parent
ea2501d455
commit
811429bfd4
2 changed files with 3 additions and 3 deletions
|
@ -38,7 +38,7 @@ CCompiledDMABUFFeedback::CCompiledDMABUFFeedback(dev_t device, std::vector<SDMAB
|
|||
|
||||
auto arr = (SDMABUFFeedbackTableEntry*)mmap(nullptr, tableLen, PROT_READ | PROT_WRITE, MAP_SHARED, fds[0], 0);
|
||||
|
||||
if (!arr) {
|
||||
if (arr == MAP_FAILED) {
|
||||
LOGM(ERR, "mmap failed");
|
||||
close(fds[0]);
|
||||
close(fds[1]);
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue