Allow load() and exec() methods to be NULL.
This commit is contained in:
parent
8a490146bf
commit
7dc50167bb
|
@ -116,6 +116,11 @@ struct image * find_image ( const char *name ) {
|
||||||
static int image_load_type ( struct image *image, struct image_type *type ) {
|
static int image_load_type ( struct image *image, struct image_type *type ) {
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
/* Check image is actually loadable */
|
||||||
|
if ( ! type->load )
|
||||||
|
return -ENOEXEC;
|
||||||
|
|
||||||
|
/* Try the image loader */
|
||||||
if ( ( rc = type->load ( image ) ) != 0 ) {
|
if ( ( rc = type->load ( image ) ) != 0 ) {
|
||||||
DBGC ( image, "IMAGE %p could not load as %s: %s\n",
|
DBGC ( image, "IMAGE %p could not load as %s: %s\n",
|
||||||
image, type->name, strerror ( rc ) );
|
image, type->name, strerror ( rc ) );
|
||||||
|
@ -180,6 +185,10 @@ int image_exec ( struct image *image ) {
|
||||||
|
|
||||||
assert ( image->type != NULL );
|
assert ( image->type != NULL );
|
||||||
|
|
||||||
|
/* Check that image is actually executable */
|
||||||
|
if ( ! image->type->exec )
|
||||||
|
return -ENOEXEC;
|
||||||
|
|
||||||
/* Try executing the image */
|
/* Try executing the image */
|
||||||
if ( ( rc = image->type->exec ( image ) ) != 0 ) {
|
if ( ( rc = image->type->exec ( image ) ) != 0 ) {
|
||||||
DBGC ( image, "IMAGE %p could not execute: %s\n",
|
DBGC ( image, "IMAGE %p could not execute: %s\n",
|
||||||
|
|
Reference in New Issue