summaryrefslogtreecommitdiff
path: root/Libraries/LibVT
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-01-10 09:40:59 +0100
committerAndreas Kling <kling@serenityos.org>2021-01-10 09:40:59 +0100
commit13e8a2a671d7d196cabc51987935b1e815102868 (patch)
treeb85d7f659a4042fd8a9da86874fa35f10e71b17b /Libraries/LibVT
parente855aac1f584e83d4e6532212bdf56819d605fb3 (diff)
downloadserenity-13e8a2a671d7d196cabc51987935b1e815102868.zip
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.
Diffstat (limited to 'Libraries/LibVT')
-rw-r--r--Libraries/LibVT/TerminalWidget.cpp6
1 files 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.");
+ }
}
}