aboutsummaryrefslogtreecommitdiff
path: root/shm.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-03-25 17:32:41 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-03-25 17:32:41 +0000
commite9f1638750db342fbf26fc9477a970ab2e3e439d (patch)
tree2388fc881866ab227b8b266abf8d82c4842a5ef5 /shm.c
parentshm: seal the memfd (diff)
shm: handle ftruncate failure
Diffstat (limited to 'shm.c')
-rw-r--r--shm.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/shm.c b/shm.c
index dc633ae3..7ac1f6c8 100644
--- a/shm.c
+++ b/shm.c
@@ -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(