summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2010-01-25 17:07:56 -0500
committerRay Strode <rstrode@redhat.com>2010-01-26 01:20:00 -0500
commit33b761ebe04e032741966afdd4058b717e96b08a (patch)
tree46cece3d0009fbae3ae3796be7d4dd72c223bb7d /src/client
parent6a9c53419527e88edef1e2a1ed9347a16cd4f59b (diff)
[client] Run ask-for-password command unconditionally
Even if we can't contact the daemon, we should still run the ask-for-password command. This is because the command may do things important for boot up to continue like unlocking the root partition.
Diffstat (limited to 'src/client')
-rw-r--r--src/client/plymouth.c43
1 files changed, 41 insertions, 2 deletions
diff --git a/src/client/plymouth.c b/src/client/plymouth.c
index c00dddae..657feb01 100644
--- a/src/client/plymouth.c
+++ b/src/client/plymouth.c
@@ -186,9 +186,48 @@ on_success (state_t *state)
}
static void
-on_password_answer_failure (password_answer_state_t *answer_state, ply_boot_client_t *client)
+on_password_answer_failure (password_answer_state_t *answer_state,
+ ply_boot_client_t *client)
{
- ply_event_loop_exit (answer_state->state->loop, 1);
+ /* plymouthd isn't running for some reason. If there is a command
+ * to run, we'll run it anyway, because it might be important for
+ * boot up to continue (to decrypt the root partition or whatever)
+ */
+ if (answer_state->command != NULL)
+ {
+ int exit_status;
+ bool command_started;
+
+ exit_status = 127;
+ command_started = false;
+ while (answer_state->number_of_tries_left > 0)
+ {
+ command_started = answer_via_command (answer_state->command, NULL,
+ &exit_status);
+
+ if (command_started && WIFEXITED (exit_status) &&
+ WEXITSTATUS (exit_status) == 0)
+ {
+ break;
+ }
+
+ answer_state->number_of_tries_left--;
+ }
+
+ if (command_started && WIFSIGNALED (exit_status))
+ {
+ raise (WTERMSIG (exit_status));
+ }
+ else
+ {
+ ply_event_loop_exit (answer_state->state->loop,
+ WEXITSTATUS (exit_status));
+ }
+ }
+ else
+ {
+ ply_event_loop_exit (answer_state->state->loop, 1);
+ }
}
static void