diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2012-08-24 06:55:53 +0000 |
---|---|---|
committer | Riku Voipio <riku.voipio@linaro.org> | 2012-10-12 14:25:56 +0300 |
commit | 885c1d10b803fc37e6656e733ba916c702b6f515 (patch) | |
tree | ccfdb332143a1e203c46492ef35ef8657b463daa /linux-user/linuxload.c | |
parent | a05c64091509056b7e321537196db967f2545601 (diff) |
linux-user: If loading fails, print error as string, not number
If the attempt to load the guest executable fails, print the
error message as a string, not a number. This requires us to
fix a couple of places in loader_exec() where we were returning
-1 instead of a valid negative errno.
The change allows us to drop the "Unknown binary format" message
because the strerror-enhanced message is now a more self-explanatory
"Error while loading $guest-binary: Exec format error".
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Diffstat (limited to 'linux-user/linuxload.c')
-rw-r--r-- | linux-user/linuxload.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/linux-user/linuxload.c b/linux-user/linuxload.c index b47025f08a..381ab8914b 100644 --- a/linux-user/linuxload.c +++ b/linux-user/linuxload.c @@ -140,8 +140,9 @@ int loader_exec(const char * filename, char ** argv, char ** envp, bprm->p = TARGET_PAGE_SIZE*MAX_ARG_PAGES-sizeof(unsigned int); memset(bprm->page, 0, sizeof(bprm->page)); retval = open(filename, O_RDONLY); - if (retval < 0) - return retval; + if (retval < 0) { + return -errno; + } bprm->fd = retval; bprm->filename = (char *)filename; bprm->argc = count(argv); @@ -165,8 +166,7 @@ int loader_exec(const char * filename, char ** argv, char ** envp, retval = load_flt_binary(bprm,regs,infop); #endif } else { - fprintf(stderr, "Unknown binary format\n"); - return -1; + return -ENOEXEC; } } |