Imported Debian patch 3.4-9
[debian/elilo] / choosers / simple.c
index 9b0725e4b8264712d56e8f329b0fcf836696707c..31bbe4ccc05911938e53884b24a0a22e81d61b17 100644 (file)
@@ -303,14 +303,14 @@ restart:
         * if no match is found, the args and initrd arguments may
         * still be modified by global options in the config file.
         */
-       ret = find_label(argv[index], kname, args, initrd_name);
+       ret = find_label((index < argc) ? argv[index] : NULL, kname, args, initrd_name);
 
        /*
         * not found, so assume first argument is kernel name and
         * not label name 
         */
        if (ret == -1) {
-               if (argv[index]) 
+               if ((index < argc) && argv[index])
                        StrCpy(kname, argv[index]);
                else
                        StrCpy(kname, elilo_opt.default_kernel);
@@ -347,6 +347,7 @@ restart:
                if (ret != 0) {
                        elilo_opt.prompt = 1;
                        elilo_opt.timeout =  ELILO_TIMEOUT_INFINITY;
+                       elilo_opt.initrd[0] = CHAR_NULL;
                        goto restart;
                }
        }