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.
This commit is contained in:
Andreas Kling 2021-01-10 09:40:59 +01:00
parent e855aac1f5
commit 13e8a2a671
Notes: sideshowbarker 2024-07-18 23:58:16 +09:00

View file

@ -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.");
}
}
}