diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-03-25 17:32:41 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-03-25 17:32:41 +0000 |
| commit | e9f1638750db342fbf26fc9477a970ab2e3e439d (patch) | |
| tree | 2388fc881866ab227b8b266abf8d82c4842a5ef5 | |
| parent | shm: seal the memfd (diff) | |
shm: handle ftruncate failure
| -rw-r--r-- | shm.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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( |
