[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 09/49] semihosting: Adjust error checking in common_semi_cb
From: |
Richard Henderson |
Subject: |
[PATCH v3 09/49] semihosting: Adjust error checking in common_semi_cb |
Date: |
Fri, 20 May 2022 17:03:20 -0700 |
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.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
semihosting/arm-compat-semi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c
index b00ed2c6d1..88e1c286ba 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;
--
2.34.1
- [PATCH v3 00/49] semihosting cleanup, Richard Henderson, 2022/05/20
- [PATCH v3 01/49] semihosting: Move exec/softmmu-semi.h to semihosting/softmmu-uaccess.h, Richard Henderson, 2022/05/20
- [PATCH v3 02/49] semihosting: Return failure from softmmu-uaccess.h functions, Richard Henderson, 2022/05/20
- [PATCH v3 10/49] semihosting: Clean up common_semi_flen_cb, Richard Henderson, 2022/05/20
- [PATCH v3 06/49] semihosting: Simplify softmmu_lock_user_string, Richard Henderson, 2022/05/20
- [PATCH v3 08/49] semihosting: Inline set_swi_errno into common_semi_cb, Richard Henderson, 2022/05/20
- [PATCH v3 09/49] semihosting: Adjust error checking in common_semi_cb,
Richard Henderson <=
[PATCH v3 05/49] semihosting: Add target_strlen for softmmu-uaccess.h, Richard Henderson, 2022/05/20
[PATCH v3 11/49] semihosting: Clean up common_semi_open_cb, Richard Henderson, 2022/05/20
[PATCH v3 07/49] semihosting: Split out guestfd.c, Richard Henderson, 2022/05/20
[PATCH v3 04/49] semihosting: Move softmmu-uaccess.h functions out of line, Richard Henderson, 2022/05/20
[PATCH v3 13/49] semihosting: Move common-semi.h to include/semihosting/, Richard Henderson, 2022/05/20