[keyboard] Don't blow an assertion if terminal is unavailable

Right now, we always assume the tty can be reopened when it
gets disconnected.  This isn't always true.  While plymouth
clearly won't function 100% properly without a tty, we shouldn't
blow an assertion.
This commit is contained in:
Ray Strode 2010-06-02 18:28:02 -04:00
parent d9aa8907f3
commit 648745cddb

View file

@ -359,6 +359,13 @@ ply_keyboard_watch_for_terminal_input (ply_keyboard_t *keyboard)
assert (keyboard != NULL);
terminal_fd = ply_terminal_get_fd (keyboard->provider.if_terminal->terminal);
if (terminal_fd < 0 || !ply_terminal_is_open (keyboard->provider.if_terminal->terminal))
{
ply_trace ("terminal associated with keyboard isn't open");
return false;
}
keyboard->provider.if_terminal->input_watch = ply_event_loop_watch_fd (keyboard->loop, terminal_fd, PLY_EVENT_LOOP_FD_STATUS_HAS_DATA,
(ply_event_handler_t) on_terminal_data,
(ply_event_handler_t) on_terminal_disconnected,