ldlinux: Parse ALLOWOPTIONS directive
authorMatt Fleming <matt.fleming@intel.com>
Thu, 3 May 2012 12:54:14 +0000 (13:54 +0100)
committerMatt Fleming <matt.fleming@intel.com>
Thu, 3 May 2012 13:52:17 +0000 (14:52 +0100)
Specifying the ALLOWOPTIONS directive doesn't have any effect at the
moment. Fix this so that if ALLOWOPTIONS 0 is used then command line
arguments are ignored.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
com32/elflink/ldlinux/ldlinux.c
com32/elflink/ldlinux/readconfig.c

index c9ec9ac..f11a65c 100644 (file)
@@ -164,6 +164,12 @@ static void load_kernel(const char *command_line)
        if (!allowimplicit)
                goto bad_implicit;
 
+       /* Insert a null character to ignore any user-specified options */
+       if (!allowoptions) {
+               char *p = (char *)find_command(kernel);
+               *p = '\0';
+       }
+
        type = parse_kernel_type(kernel);
        if (type == KT_KERNEL) {
                const char *ext;
index 885c81a..1a8434c 100644 (file)
@@ -1090,7 +1090,7 @@ do_include:
            ontimeout = refstrdup(skipspace(p + 9));
            ontimeoutlen = strlen(ontimeout);
        } else if (looking_at(p, "allowoptions")) {
-           m->allowedit = !!atoi(skipspace(p + 12));
+           allowoptions = !!atoi(skipspace(p + 12));
        } else if (looking_at(p, "ipappend")) {
            if (ld.label)
                ld.ipappend = atoi(skipspace(p + 8));