aboutsummaryrefslogtreecommitdiff
path: root/terminal.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2024-07-30 14:33:19 +0000
committerDaniel Eklöf <daniel@ekloef.se>2024-07-30 14:33:19 +0000
commit0a5ba708e4a8448a0d29d4e263f939c9d1d2b953 (patch)
tree2b7cf3474d07b987d37956d1b4d6fc0485a81bbb /terminal.c
parentreadme: IRC: update link to point to the web interface (diff)
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.
Diffstat (limited to 'terminal.c')
-rw-r--r--terminal.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/terminal.c b/terminal.c
index dc4f37b6..e95a3615 100644
--- a/terminal.c
+++ b/terminal.c
@@ -1330,6 +1330,10 @@ term_init(const struct config *conf, struct fdm *fdm, struct reaper *reaper,
}
}
+ for (size_t i = 0; i < ALEN(term->notification_icons); i++) {
+ term->notification_icons[i].tmp_file_fd = -1;
+ }
+
add_utmp_record(conf, reaper, ptmx);
if (!pty_path) {