From: Ray Strode Date: Fri, 10 Sep 2010 19:43:28 +0000 (-0400) Subject: main: Fix up check_for_consoles X-Git-Tag: 0.8.4~118 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7c7bdbf7639ebfd16875cba63f2a63404193ec4;p=thirdparty%2Fplymouth.git main: Fix up check_for_consoles commit c40fd792b6edf931a6bbe2ec23518b57483a4e2f was just wrong. Attempt to fix it up to be less awful. --- diff --git a/src/main.c b/src/main.c index 27ec95c6..b06dbdc7 100644 --- a/src/main.c +++ b/src/main.c @@ -1755,8 +1755,9 @@ check_for_consoles (state_t *state, const char *default_tty, bool should_add_displays) { - const char *console; + const char *console_string; const char *remaining_command_line; + char *console; ply_hashtable_t *consoles; ply_trace ("checking for consoles%s", @@ -1766,25 +1767,26 @@ check_for_consoles (state_t *state, consoles = ply_hashtable_new (ply_hashtable_string_hash, ply_hashtable_string_compare); - while ((console = command_line_get_string_after_prefix (remaining_command_line, - "console=")) != NULL) + while ((console_string = command_line_get_string_after_prefix (remaining_command_line, + "console=")) != NULL) { char *end; - state->should_force_details = true; + remaining_command_line = console_string; - ply_trace ("serial console %s found!", console); - ply_hashtable_insert (consoles, strdup (console), NULL); + state->should_force_details = true; - remaining_command_line = console; + console = strdup (console_string); - end = strpbrk (state->kernel_console_tty, " \n\t\v,"); + end = strpbrk (console, " \n\t\v,"); if (end != NULL) - { - *end = '\0'; - console += end - state->kernel_console_tty; - } + *end = '\0'; + + ply_trace ("serial console %s found!", console); + ply_hashtable_insert (consoles, console, NULL); + + remaining_command_line += strlen (console); } free (state->kernel_console_tty);