]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
[keyboard] Don't blow an assertion if terminal is unavailable
authorRay Strode <rstrode@redhat.com>
Wed, 2 Jun 2010 22:28:02 +0000 (18:28 -0400)
committerRay Strode <rstrode@redhat.com>
Wed, 2 Jun 2010 22:28:02 +0000 (18:28 -0400)
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

index 0df3ab48bb0c6ccac66c8a1f96e85974a1059b8a..0f26bb42cc5632114bc7ddb3a1d03c164c94f56c 100644 (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,