From: Ray Strode Date: Mon, 10 Nov 2008 16:07:06 +0000 (-0500) Subject: Track "attached" versus "redirected" separately X-Git-Tag: 0.6.0~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a739a8ecafb02cdbaa8a3a2e15030bfe8549966c;p=thirdparty%2Fplymouth.git Track "attached" versus "redirected" separately We only want to try to attach the terminal session to a terminal if it's not already attached. It may be legitimately unredirected if plymouth:nolog is passed. --- diff --git a/src/main.c b/src/main.c index 5502166a..46f290a3 100644 --- a/src/main.c +++ b/src/main.c @@ -63,6 +63,8 @@ typedef struct uint32_t no_boot_log : 1; uint32_t showing_details : 1; uint32_t system_initialized : 1; + uint32_t is_redirected : 1; + uint32_t is_attached : 1; char *console; @@ -311,8 +313,22 @@ close_windows (state_t *state) static void on_show_splash (state_t *state) { + bool has_window; + open_windows (state); + has_window = has_open_window (state); + + if (!state->is_attached && state->ptmx >= 0 && has_window) + state->is_attached = attach_to_running_session (state); + + if (!has_window && state->is_attached) + { + ply_trace ("no open windows, detaching session"); + ply_terminal_session_detach (state->session); + state->is_attached = false; + } + if (plymouth_should_show_default_splash (state)) show_default_splash (state); else @@ -554,10 +570,17 @@ attach_to_running_session (state_t *state) ply_buffer_free (state->boot_buffer); state->boot_buffer = NULL; ply_restore_errno (); - return NULL; + + state->is_redirected = false; + state->is_attached = false; + return false; } - return session; + state->is_redirected = should_be_redirected; + state->is_attached = true; + state->session = session; + + return true; } static bool