aboutsummaryrefslogtreecommitdiff
path: root/linux-user/main.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2012-08-24 06:55:53 +0000
committerRiku Voipio <riku.voipio@linaro.org>2012-10-12 14:25:56 +0300
commit885c1d10b803fc37e6656e733ba916c702b6f515 (patch)
treeccfdb332143a1e203c46492ef35ef8657b463daa /linux-user/main.c
parenta05c64091509056b7e321537196db967f2545601 (diff)
downloadqemu-885c1d10b803fc37e6656e733ba916c702b6f515.zip
qemu-885c1d10b803fc37e6656e733ba916c702b6f515.tar.gz
qemu-885c1d10b803fc37e6656e733ba916c702b6f515.tar.bz2
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/main.c')
-rw-r--r--linux-user/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/linux-user/main.c b/linux-user/main.c
index 9f3476b..bcaadb6 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -3569,7 +3569,7 @@ int main(int argc, char **argv, char **envp)
ret = loader_exec(filename, target_argv, target_environ, regs,
info, &bprm);
if (ret != 0) {
- printf("Error %d while loading %s\n", ret, filename);
+ printf("Error while loading %s: %s\n", filename, strerror(-ret));
_exit(1);
}