path: root/com32/elflink/ldlinux
diff options
authorMatt Fleming <matt.fleming@intel.com>2012-11-29 09:34:18 +0000
committerMatt Fleming <matt.fleming@intel.com>2012-11-29 13:28:47 +0000
commit0174945b6b604425e8f576c0af0908ce00cdc493 (patch)
treeea0b2b8958fb687dd8c20f423606f32101080321 /com32/elflink/ldlinux
parent771aea5ed2eb791717eea939089f8246a47d8634 (diff)
ldlinux: Complain to user on failure to perform file operations
If we fail to chdir or to execute a COM32 file we should inform the user so that they can debug the problem. We don't currently print anything if the user tries to execute a regular file, such as a config file, as an COM32 image. We also shouldn't be returning the exit value of the module from spawn_load(), because we have no way of doing anything useful with it, and just because a main() function returns -1 doesn't mean it failed to run. Modules need to take care of printing any error messages themselves. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'com32/elflink/ldlinux')
2 files changed, 4 insertions, 2 deletions
diff --git a/com32/elflink/ldlinux/execute.c b/com32/elflink/ldlinux/execute.c
index 10399230..2f0e037e 100644
--- a/com32/elflink/ldlinux/execute.c
+++ b/com32/elflink/ldlinux/execute.c
@@ -109,7 +109,8 @@ void execute(const char *cmdline, uint32_t type)
/* new entry for elf format c32 */
- create_args_and_load((char *)cmdline);
+ if (create_args_and_load((char *)cmdline))
+ printf("Failed to load COM32 file %s\n", kernel);
* The old COM32 module code would run the module then
diff --git a/com32/elflink/ldlinux/readconfig.c b/com32/elflink/ldlinux/readconfig.c
index 2fa0641e..cc57dd8e 100644
--- a/com32/elflink/ldlinux/readconfig.c
+++ b/com32/elflink/ldlinux/readconfig.c
@@ -1368,7 +1368,8 @@ static int parse_one_config(const char *filename)
if (config_cwd[0]) {
- chdir(config_cwd);
+ if (chdir(config_cwd) < 0)
+ printf("Failed to chdir to %s\n", config_cwd);
config_cwd[0] = '\0';