[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 10/74] semihosting: Adjust error checking in common_semi_cb
From: |
Richard Henderson |
Subject: |
[PATCH v2 10/74] semihosting: Adjust error checking in common_semi_cb |
Date: |
Tue, 3 May 2022 12:47:39 -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 7030dfd587..18664b1c47 100644
--- a/semihosting/arm-compat-semi.c
+++ b/semihosting/arm-compat-semi.c
@@ -276,7 +276,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 v2 06/74] semihosting: Simplify softmmu_lock_user_string, (continued)
- [PATCH v2 06/74] semihosting: Simplify softmmu_lock_user_string, Richard Henderson, 2022/05/03
- [PATCH v2 07/74] semihosting: Split out guestfd.c, Richard Henderson, 2022/05/03
- [PATCH v2 08/74] semihosting: Generalize GuestFDFeatureFile, Richard Henderson, 2022/05/03
- [PATCH v2 09/74] semihosting: Return void from do_common_semihosting, Richard Henderson, 2022/05/03
- [PATCH v2 13/74] include/exec: Move gdb_stat and gdb_timeval to gdbstub.h, Richard Henderson, 2022/05/03
- [PATCH v2 10/74] semihosting: Adjust error checking in common_semi_cb,
Richard Henderson <=
- [PATCH v2 12/74] include/exec: Move gdb open flags to gdbstub.h, Richard Henderson, 2022/05/03
- [PATCH v2 14/74] include/exec: Define errno values in gdbstub.h, Richard Henderson, 2022/05/03
- [PATCH v2 15/74] semihosting: Use struct gdb_stat in common_semi_flen_cb, Richard Henderson, 2022/05/03
- [PATCH v2 17/74] semihosting: Split common_semi_flen_buf per target, Richard Henderson, 2022/05/03
- [PATCH v2 16/74] semihosting: Split is_64bit_semihosting per target, Richard Henderson, 2022/05/03
- [PATCH v2 19/74] semihosting: Use env more often in do_common_semihosting, Richard Henderson, 2022/05/03
- [PATCH v2 22/74] semihosting: Split out semihost_sys_close, Richard Henderson, 2022/05/03
- [PATCH v2 21/74] semihosting: Split out semihost_sys_open, Richard Henderson, 2022/05/03