diff options
author | Richard Henderson | 2022-04-29 21:32:24 +0200 |
---|---|---|
committer | Richard Henderson | 2022-06-28 01:05:07 +0200 |
commit | 709fe27b189aa86c801b9bd655f9267fec17d0d0 (patch) | |
tree | b735252f0020e9f7b2cc5c372546ce17673d6537 /semihosting | |
parent | semihosting: Inline set_swi_errno into common_semi_cb (diff) | |
download | qemu-709fe27b189aa86c801b9bd655f9267fec17d0d0.tar.gz qemu-709fe27b189aa86c801b9bd655f9267fec17d0d0.tar.xz qemu-709fe27b189aa86c801b9bd655f9267fec17d0d0.zip |
semihosting: Adjust error checking in common_semi_cb
The err parameter is non-zero if and only if an error occured.
Use this instead of ret == -1 for determining if we need to
update the saved errno.
This fixes the errno setting of SYS_ISTTY, which returns 0 on
error, not -1.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'semihosting')
-rw-r--r-- | semihosting/arm-compat-semi.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c index 9d1f13ea8b..88d6bdeaf2 100644 --- a/semihosting/arm-compat-semi.c +++ b/semihosting/arm-compat-semi.c @@ -290,7 +290,7 @@ static target_ulong common_semi_syscall_len; static void common_semi_cb(CPUState *cs, target_ulong ret, target_ulong err) { - if (ret == (target_ulong)-1) { + if (err) { #ifdef CONFIG_USER_ONLY TaskState *ts = cs->opaque; ts->swi_errno = err; |