diff mbox series

[v8,3/6] lib/cmdline.c: Remove quotes symmetrically.

Message ID 9ad57a14bf19e798c5a3643e57a28e829a8518a2.1505231820.git.msuchanek@suse.de (mailing list archive)
State Superseded
Headers show
Series [v8,1/6] powerpc/fadump: reduce memory consumption for capture kernel | expand

Commit Message

Michal Suchánek Sept. 12, 2017, 4:01 p.m. UTC
Remove quotes from argument value only if there is qoute on both sides.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
 lib/cmdline.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/lib/cmdline.c b/lib/cmdline.c
index 171c19b6888e..6d398a8b63fc 100644
--- a/lib/cmdline.c
+++ b/lib/cmdline.c
@@ -227,14 +227,12 @@  char *next_arg(char *args, char **param, char **val)
 		*val = args + equals + 1;
 
 		/* Don't include quotes in value. */
-		if (**val == '"') {
-			(*val)++;
-			if (args[i-1] == '"')
-				args[i-1] = '\0';
+		if ((args[i-1] == '"') && ((quoted) || (**val == '"'))) {
+			args[i-1] = '\0';
+			if (!quoted)
+				(*val)++;
 		}
 	}
-	if (quoted && args[i-1] == '"')
-		args[i-1] = '\0';
 
 	if (args[i]) {
 		args[i] = '\0';