ldlinux_enter_command();
} else if (type == IMAGE_TYPE_CONFIG) {
char *argv[] = { "ldlinux.c32", NULL };
+ int rv;
/* kernel contains the config file name */
realpath(ConfigName, kernel, FILENAME_MAX);
if (*args)
mangle_name(config_cwd, args);
- start_ldlinux(argv);
+ rv = start_ldlinux(argv);
+ printf("Failed to exec ldlinux.c32: %s\n", strerror(rv));
} else if (type == IMAGE_TYPE_LOCALBOOT) {
local_boot(strtoul(kernel, NULL, 0));
} else if (type == IMAGE_TYPE_PXE || type == IMAGE_TYPE_BSS ||
* unload all the modules loaded since ldlinux.c32,
* and restart initialisation. This is especially
* important for config files.
+ *
+ * But before we do that, try our best to make sure
+ * that spawn_load() is gonna succeed, e.g. that we
+ * can find LDLINUX it in PATH.
*/
struct elf_module *ldlinux;
+ FILE *f;
+
+ f = findpath(LDLINUX);
+ if (!f)
+ return ENOENT;
+ fclose(f);
ldlinux = unload_modules_since(LDLINUX);
/*