]> xenbits.xensource.com Git - people/aperard/xen-arm.git/commitdiff
Fix pygrub handling non-default entry
authorMiroslav Rezanina <mrezanin@redhat.com>
Thu, 17 Jan 2013 13:53:07 +0000 (13:53 +0000)
committerMiroslav Rezanina <mrezanin@redhat.com>
Thu, 17 Jan 2013 13:53:07 +0000 (13:53 +0000)
If we pass 0 as pygrub --entry argument (i.e. we want to boot first item), default value is used instead. This is dueto wrong check for range of allowed values of index - 0 is index of first item.

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
Acked-by: Matt Wilson <msw@amazon.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
tools/pygrub/src/pygrub

index 1845485a0406a119cf8635e2b0ee2d138949db0c..eedfdb2fbf3914ba6b10a17da50849bad0704392 100644 (file)
@@ -613,7 +613,7 @@ def run_grub(file, entry, fs, cfg_args):
     # set the entry to boot as requested
     if entry is not None:
         idx = get_entry_idx(g.cf, entry)
-        if idx is not None and idx > 0 and idx < len(g.cf.images):
+        if idx is not None and idx >= 0 and idx < len(g.cf.images):
            sel = idx
 
     if sel == -1: