lkml.org 
[lkml]   [2017]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Subject[PATCH v9 1/8] lib/cmdline.c: remove quotes symmetrically
    From
    Date
    From: Michal Suchanek <msuchanek@suse.de>

    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 --git a/lib/cmdline.c b/lib/cmdline.c
    index 171c19b..6d398a8 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';
    \
     
     \ /
      Last update: 2017-11-15 16:17    [W:4.805 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site