From 5f97d0e6305ae42d4b9017776161681ff538e838 Mon Sep 17 00:00:00 2001 From: Icarus Sparry Date: Tue, 1 May 2018 11:12:06 -0700 Subject: [PATCH] Use exit instead of assert when checking images Print an error message and exit rather than using assert, so it is more obvious what the problem is and no core files are produced. Fixes #61 Signed-off-by: Icarus Sparry --- core/sw_load_bzimage.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/core/sw_load_bzimage.c b/core/sw_load_bzimage.c index f9d8d7a2c..ce35dfa48 100644 --- a/core/sw_load_bzimage.c +++ b/core/sw_load_bzimage.c @@ -133,8 +133,11 @@ acrn_parse_kernel(char *arg) if (len < STR_LEN) { strncpy(kernel_path, arg, len); kernel_path[len] = '\0'; - assert(check_image(kernel_path) == 0); - + if (check_image(kernel_path) != 0){ + fprintf(stderr, "SW_LOAD: check_image failed for '%s'\n", + kernel_path); + exit(10); /* Non-zero */ + } with_kernel = 1; printf("SW_LOAD: get kernel path %s\n", kernel_path); return 0; @@ -150,7 +153,11 @@ acrn_parse_ramdisk(char *arg) if (len < STR_LEN) { strncpy(ramdisk_path, arg, len); ramdisk_path[len] = '\0'; - assert(check_image(ramdisk_path) == 0); + if (check_image(ramdisk_path) != 0){ + fprintf(stderr, "SW_LOAD: check_image failed for '%s'\n", + ramdisk_path); + exit(11); /* Non-zero */ + } with_ramdisk = 1; printf("SW_LOAD: get ramdisk path %s\n", ramdisk_path);