]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
cat: Don't switch terminal mode when there is nothing to highlight.
authorVladimir Serbinenko <phcoder@gmail.com>
Fri, 26 Feb 2016 11:26:56 +0000 (12:26 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Sat, 27 Feb 2016 12:35:36 +0000 (13:35 +0100)
This just pollutes serial console.

grub-core/commands/cat.c

index 8a7f1af78444bd830fa912ea34bee53dd79d082f..88d90443602eef4131b682e12215b52b55720bdf 100644 (file)
@@ -140,10 +140,13 @@ grub_cmd_cat (grub_extcmd_context_t ctxt, int argc, char **args)
       grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
     }
 
-  grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT);
-  for (j = 0; j < utcount; j++)
-    grub_printf ("<%x>", (unsigned int) utbuf[j]);
-  grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
+  if (utcount)
+    {
+      grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT);
+      for (j = 0; j < utcount; j++)
+       grub_printf ("<%x>", (unsigned int) utbuf[j]);
+      grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
+    }
 
   grub_xputs ("\n");
   grub_refresh ();