shm: handle ftruncate failure

This commit is contained in:
Daniel Eklöf 2020-03-25 18:32:41 +01:00
parent dc42cc1d19
commit e9f1638750
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

6
shm.c
View file

@ -264,8 +264,12 @@ shm_get_buffer(struct wl_shm *shm, int width, int height, unsigned long cookie,
if (scrollable && !can_punch_hole) {
initial_offset = 0;
memfd_size = size;
ftruncate(pool_fd, memfd_size);
scrollable = false;
if (ftruncate(pool_fd, memfd_size) < 0) {
LOG_ERRNO("failed to set size of SHM backing memory file");
goto err;
}
}
real_mmapped = mmap(