From 648745cddb47f0d3977f373e34ec285c9dc53e4f Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Wed, 2 Jun 2010 18:28:02 -0400 Subject: [PATCH] [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. --- src/libply-splash-core/ply-keyboard.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libply-splash-core/ply-keyboard.c b/src/libply-splash-core/ply-keyboard.c index 0df3ab48..0f26bb42 100644 --- a/src/libply-splash-core/ply-keyboard.c +++ b/src/libply-splash-core/ply-keyboard.c @@ -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,