]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
[main] Properly handle no serial consoles
authorRay Strode <rstrode@redhat.com>
Thu, 5 Aug 2010 01:05:21 +0000 (21:05 -0400)
committerRay Strode <rstrode@redhat.com>
Thu, 5 Aug 2010 01:05:21 +0000 (21:05 -0400)
The previous commit introduced an error where
console could potentially be accessed while
NULL.

This commit addresses that problem.

src/main.c

index 089f4c4df54ff7f68dff7f9bee74903325d3a5b8..94c0d3213fc6156b25a2507282bfea92b23f7a4c 100644 (file)
@@ -1760,11 +1760,15 @@ check_for_consoles (state_t    *state,
     }
 
   free (state->kernel_console_tty);
+  state->kernel_console_tty = NULL;
 
-  if (strcmp (console, "tty0") == 0 || strcmp (console, "/dev/tty0") == 0)
-      state->kernel_console_tty = strdup (default_tty);
-  else
-      state->kernel_console_tty = strdup (console);
+  if (console != NULL)
+    {
+      if (strcmp (console, "tty0") == 0 || strcmp (console, "/dev/tty0") == 0)
+          state->kernel_console_tty = strdup (default_tty);
+      else
+          state->kernel_console_tty = strdup (console);
+    }
 
   if (should_add_displays)
     {