summaryrefslogtreecommitdiffstats
path: root/src/core/image.c
diff options
context:
space:
mode:
authorMichael Brown2007-01-14 15:59:36 +0100
committerMichael Brown2007-01-14 15:59:36 +0100
commit7dc50167bb2e1e762993d22ec4f15dab048dfb2f (patch)
treef9c511cbab8f581f48668b259f66ce0768fd5620 /src/core/image.c
parentCopy command line at execution time rather than load time. (diff)
downloadipxe-7dc50167bb2e1e762993d22ec4f15dab048dfb2f.tar.gz
ipxe-7dc50167bb2e1e762993d22ec4f15dab048dfb2f.tar.xz
ipxe-7dc50167bb2e1e762993d22ec4f15dab048dfb2f.zip
Allow load() and exec() methods to be NULL.
Diffstat (limited to 'src/core/image.c')
-rw-r--r--src/core/image.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/core/image.c b/src/core/image.c
index b5ef7c59..7cf7f7bc 100644
--- a/src/core/image.c
+++ b/src/core/image.c
@@ -116,6 +116,11 @@ struct image * find_image ( const char *name ) {
static int image_load_type ( struct image *image, struct image_type *type ) {
int rc;
+ /* Check image is actually loadable */
+ if ( ! type->load )
+ return -ENOEXEC;
+
+ /* Try the image loader */
if ( ( rc = type->load ( image ) ) != 0 ) {
DBGC ( image, "IMAGE %p could not load as %s: %s\n",
image, type->name, strerror ( rc ) );
@@ -180,6 +185,10 @@ int image_exec ( struct image *image ) {
assert ( image->type != NULL );
+ /* Check that image is actually executable */
+ if ( ! image->type->exec )
+ return -ENOEXEC;
+
/* Try executing the image */
if ( ( rc = image->type->exec ( image ) ) != 0 ) {
DBGC ( image, "IMAGE %p could not execute: %s\n",