ldlinux: Fix OnError behaviour
authorMatt Fleming <matt.fleming@intel.com>
Mon, 26 Nov 2012 13:13:07 +0000 (13:13 +0000)
committerMatt Fleming <matt.fleming@intel.com>
Mon, 26 Nov 2012 13:21:34 +0000 (13:21 +0000)
If the ONERROR directive references a label we need to lookup the
label's command line and type.

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

index d3f8e62..4a09283 100644 (file)
@@ -201,8 +201,14 @@ bad_kernel:
         * line.
         */
        if (onerrorlen) {
-               rsprintf(&cmdline, "%s %s", onerror, default_cmd);
-               execute(cmdline, IMAGE_TYPE_COM32);
+               me = find_label(onerror);
+               if (me)
+                       rsprintf(&cmdline, "%s %s", me->cmdline, default_cmd);
+               else
+                       rsprintf(&cmdline, "%s %s", onerror, default_cmd);
+
+               type = parse_image_type(cmdline);
+               execute(cmdline, type);
        }
 }