mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-01 17:35:19 +00:00
c90a0ffff6
Previously, we used two different functions for configuring ttys. vmm_sys_util::terminal::Terminal::set_raw_mode() was used to configure stdio ttys, and cfmakeraw() was used to configure ptys created by cloud-hypervisor. When I centralized the stdio tty cleanup, I also switched to using cfmakeraw() everywhere, to avoid duplication. cfmakeraw sets the OPOST flag, but when we later reset the ttys, we used vmm_sys_util::terminal::Terminal::set_canon_mode(), which does not unset this flag. This meant that the terminal was getting mostly, but not fully, reset. To fix this without depending on the implementation of cfmakeraw(), let's just store the original termios for stdio terminals, and restore them to exactly the state we found them in when cloud-hypervisor exits. Fixes: b6feae0a ("vmm: only touch the tty flags if it's being used") Signed-off-by: Alyssa Ross <hi@alyssa.is>