mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-21 23:02:40 +00:00
term/serial: Use grub_strncpy() instead of grub_snprintf() when only copying string
Using grub_strncpy() instead of grub_snprintf() is less overhead and indicates clearly that the dest should be the same string as the source. Also fix indentation. Signed-off-by: Glenn Washburn <development@efficientek.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
1 parent
7c1a022d78
commit
712309eaae
1 file changed
+1
-1
@@ -257,7 +257,7 @@ grub_cmd_serial (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||||||
{
|
{
|
||||||
if (grub_strncmp (state[OPTION_PORT].arg, "mmio,", sizeof ("mmio,") - 1) == 0 ||
|
if (grub_strncmp (state[OPTION_PORT].arg, "mmio,", sizeof ("mmio,") - 1) == 0 ||
|
||||||
grub_strncmp (state[OPTION_PORT].arg, "pci,", sizeof ("pci,") - 1) == 0)
|
grub_strncmp (state[OPTION_PORT].arg, "pci,", sizeof ("pci,") - 1) == 0)
|
||||||
grub_snprintf (pname, sizeof (pname), "%s", state[1].arg);
|
grub_strncpy (pname, state[1].arg, sizeof (pname));
|
||||||
else
|
else
|
||||||
grub_snprintf (pname, sizeof (pname), "port%lx",
|
grub_snprintf (pname, sizeof (pname), "port%lx",
|
||||||
grub_strtoul (state[1].arg, 0, 0));
|
grub_strtoul (state[1].arg, 0, 0));
|
||||||
|
|||||||
Reference in new issue
Block a user