grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] pass kernel command line as verbatim


From: Michael Chang
Subject: [PATCH] pass kernel command line as verbatim
Date: Wed, 11 Apr 2018 16:58:54 +0800
User-agent: NeoMutt/20170421 (1.8.2)

The command line has been processed by grub shell, then the result is expected
to be passed to kernel command line as verbatim according to the grub manual
[1][2].

This patch removes extra escape character added as it helps nothing but only
creates trouble as you want them to be literal. Besides the surrounding
double-quotes added is kept as it used to protect space.

[1] https://www.gnu.org/software/grub/manual/grub/html_node/linux.html#linux
[2] 
https://www.gnu.org/software/grub/manual/grub/html_node/xen_005fhypervisor.html

Signed-off-by: Michael Chang <address@hidden>
---
 grub-core/lib/cmdline.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/grub-core/lib/cmdline.c b/grub-core/lib/cmdline.c
index d5e10ee87..26b8131c8 100644
--- a/grub-core/lib/cmdline.c
+++ b/grub-core/lib/cmdline.c
@@ -27,9 +27,7 @@ static unsigned int check_arg (char *c, int *has_space)
 
   while (*c)
     {
-      if (*c == '\\' || *c == '\'' || *c == '"')
-       size++;
-      else if (*c == ' ')
+      if (*c == ' ')
        space = 1;
 
       size++;
@@ -84,13 +82,7 @@ int grub_create_loader_cmdline (int argc, char *argv[], char 
*buf,
        *buf++ = '"';
 
       while (*c)
-       {
-         if (*c == '\\' || *c == '\'' || *c == '"')
-           *buf++ = '\\';
-
-         *buf++ = *c;
-         c++;
-       }
+       *buf++ = *c++;
 
       if (space)
        *buf++ = '"';
-- 
2.16.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]