]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
main: fix kernel command line parsing
authorRay Strode <rstrode@redhat.com>
Wed, 12 Oct 2011 19:50:56 +0000 (15:50 -0400)
committerRay Strode <rstrode@redhat.com>
Wed, 12 Oct 2011 19:50:56 +0000 (15:50 -0400)
check_for_consoles has another bug (surprised?) where it would
jump too many characters forward if the command line has
console=tty0 in it, since tty0 is transparently changed to /dev/tty1.

src/main.c

index 140df67cc9682c4c252bb3e9c03f5bac0d438359..7e70196a144b4fc4d773dd0ba6125d8c7bb2a379 100644 (file)
@@ -1827,6 +1827,7 @@ check_for_consoles (state_t    *state,
                                                                  "console=")) != NULL)
     {
       char *end;
+      size_t console_length;
 
       remaining_command_line = console_string;
 
@@ -1839,6 +1840,8 @@ check_for_consoles (state_t    *state,
       if (end != NULL)
         *end = '\0';
 
+      console_length = strlen (console);
+
       if (strcmp (console, "tty0") == 0 || strcmp (console, "/dev/tty0") == 0 ||
           strcmp (console, "tty") == 0 || strcmp (console, "/dev/tty") == 0)
         {
@@ -1849,7 +1852,7 @@ check_for_consoles (state_t    *state,
       ply_trace ("serial console %s found!", console);
       ply_hashtable_insert (consoles, console, NULL);
 
-      remaining_command_line += strlen (console);
+      remaining_command_line += console_length;
     }
 
   free (state->kernel_console_tty);