From 13e8a2a671d7d196cabc51987935b1e815102868 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 10 Jan 2021 09:40:59 +0100 Subject: [PATCH] LibVT: Don't assert if ioctl(TIOCSWINSZ) fails This ioctl can fail if we're resizing the terminal right when the shell inside it has exited. Instead of throwing up a crash reporter, whine a little bit in the debug log and exit cleanly moments later. --- Libraries/LibVT/TerminalWidget.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Libraries/LibVT/TerminalWidget.cpp b/Libraries/LibVT/TerminalWidget.cpp index c8bf33f5c5..f3b8f1b4e9 100644 --- a/Libraries/LibVT/TerminalWidget.cpp +++ b/Libraries/LibVT/TerminalWidget.cpp @@ -975,8 +975,10 @@ void TerminalWidget::terminal_did_resize(u16 columns, u16 rows) ws.ws_row = rows; ws.ws_col = columns; if (m_ptm_fd != -1) { - int rc = ioctl(m_ptm_fd, TIOCSWINSZ, &ws); - ASSERT(rc == 0); + if (ioctl(m_ptm_fd, TIOCSWINSZ, &ws) < 0) { + // This can happen if we resize just as the shell exits. + dbgln("Notifying the pseudo-terminal about a size change failed."); + } } }