[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 10/43] semihosting: Adjust error checking in common_semi_cb
From: |
Richard Henderson |
Subject: |
[PATCH 10/43] semihosting: Adjust error checking in common_semi_cb |
Date: |
Sat, 30 Apr 2022 06:28:59 -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 00/43] semihosting cleanup, Richard Henderson, 2022/04/30
- [PATCH 01/43] semihosting: Move exec/softmmu-semi.h to semihosting/softmmu-uaccess.h, Richard Henderson, 2022/04/30
- [PATCH 03/43] semihosting: Improve condition for config.c and console.c, Richard Henderson, 2022/04/30
- [PATCH 04/43] semihosting: Move softmmu-uaccess functions out of line, Richard Henderson, 2022/04/30
- [PATCH 07/43] semihosting: Split out guestfd.c, Richard Henderson, 2022/04/30
- [PATCH 10/43] semihosting: Adjust error checking in common_semi_cb,
Richard Henderson <=
- [PATCH 02/43] semihosting: Return failure from softmmu-uaccess.h functions, Richard Henderson, 2022/04/30
- [PATCH 11/43] semihosting: Move common-semi.h to include/semihosting/, Richard Henderson, 2022/04/30
- [PATCH 17/43] semihosting: Split out common_semi_has_synccache, Richard Henderson, 2022/04/30
- [PATCH 13/43] include/exec: Move gdb_stat and gdb_timeval to gdbstub.h, Richard Henderson, 2022/04/30
- [PATCH 25/43] semihosting: Split out semihost_sys_lseek, Richard Henderson, 2022/04/30
- [PATCH 12/43] include/exec: Move gdb open flags to gdbstub.h, Richard Henderson, 2022/04/30
- [PATCH 05/43] semihosting: Add target_strlen for softmmu-uaccess.h, Richard Henderson, 2022/04/30
- [PATCH 20/43] semihosting: Split out semihost_sys_open, Richard Henderson, 2022/04/30
- [PATCH 19/43] semihosting: Move GET_ARG/SET_ARG earlier in the file, Richard Henderson, 2022/04/30
- [PATCH 24/43] semihosting: Bound length for semihost_sys_{read, write}, Richard Henderson, 2022/04/30