From 0a5ba708e4a8448a0d29d4e263f939c9d1d2b953 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Tue, 30 Jul 2024 16:33:19 +0200 Subject: notify: don't close FD 0 This fixes a regression where closing a terminal instance, or hard- or soft-resetting a terminal caused FD 0 to be closed. This meant it became re-usable. Usually, by memfd_create() when allocating a new surface buffer. So far nothing _really_ bad has happened. But what if FD 0 is now used by a memfd, and we close _another_ terminal instance? This causes our memfd to be closed. And then, when e.g. trying to scroll the terminal content: fallocate() fails with bad FD. --- shm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'shm.c') diff --git a/shm.c b/shm.c index 879745d4..04cec211 100644 --- a/shm.c +++ b/shm.c @@ -255,7 +255,7 @@ instantiate_offset(struct buffer_private *buf, off_t new_offset) void *mmapped = MAP_FAILED; struct wl_buffer *wl_buf = NULL; - pixman_image_t **pix = xcalloc(buf->public.pix_instances, sizeof(*pix)); + pixman_image_t **pix = xcalloc(buf->public.pix_instances, sizeof(pix[0])); mmapped = (uint8_t *)pool->real_mmapped + new_offset; -- cgit v1.3