]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
main: Fix up check_for_consoles
authorRay Strode <rstrode@redhat.com>
Fri, 10 Sep 2010 19:43:28 +0000 (15:43 -0400)
committerRay Strode <rstrode@redhat.com>
Fri, 10 Sep 2010 19:45:11 +0000 (15:45 -0400)
commit c40fd792b6edf931a6bbe2ec23518b57483a4e2f was just wrong.

Attempt to fix it up to be less awful.

src/main.c

index 27ec95c626623ca14983edc37d64735674c2637f..b06dbdc77794ccea7a0b86ee83de54a9fea36b99 100644 (file)
@@ -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);