]> git.ozlabs.org Git - petitboot/commitdiff
parser/grub2: Better menuentry parsing
authorGeoff Levand <geoff@infradead.org>
Fri, 17 May 2013 06:28:45 +0000 (14:28 +0800)
committerGeoff Levand <geoff@infradead.org>
Fri, 17 May 2013 09:43:54 +0000 (17:43 +0800)
Grub2 menuentry entry text can use double or single quotes.

Signed-off-by: Geoff Levand <geoff@infradead.org>
discover/grub2-parser.c

index a2308ee687d9ed99ba9190f6d4f80b527c6f43a8..bd08ec0a70c750f90d91f4c609bd427125ceb594 100644 (file)
@@ -141,8 +141,6 @@ static void grub2_process_pair(struct conf_context *conf, const char *name,
                return;
 
        if (streq(name, "menuentry")) {
-               char *sep;
-
                /* complete any existing option... */
                if (state->opt)
                        grub2_finish(conf);
@@ -151,10 +149,7 @@ static void grub2_process_pair(struct conf_context *conf, const char *name,
                opt = discover_boot_option_create(conf->dc, conf->dc->device);
                opt->option->boot_args = talloc_strdup(opt->option, "");
 
-               sep = strchr(value, '\'');
-
-               if (sep)
-                       *sep = 0;
+               value = strtok(value, "\'{\"");
 
                opt->option->id = talloc_asprintf(opt->option,
                                        "%s#%s", dev->id, value);