From 4487270ea434782f25f790892c5f7d03b7cbe243 Mon Sep 17 00:00:00 2001 From: Jan Matyas Date: Fri, 4 Jun 2021 11:41:36 +0200 Subject: [PATCH] target/semihosting: Capture errno in SEMIHOSTING_SYS_ISTTY Capture the value of "errno" in semihosting isatty() call, as is done in other syscalls. Change-Id: I41b72175635f06c000536f583e3efa30fb57379e Signed-off-by: Jan Matyas Reviewed-on: http://openocd.zylin.com/6292 Tested-by: jenkins Reviewed-by: Tim Newsome Reviewed-by: Antonio Borneo --- src/target/semihosting_common.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/target/semihosting_common.c b/src/target/semihosting_common.c index 61a69d1bd..bfb1ecaa7 100644 --- a/src/target/semihosting_common.c +++ b/src/target/semihosting_common.c @@ -615,6 +615,7 @@ int semihosting_common(struct target *target) return retval; int fd = semihosting_get_field(target, 0, fields); semihosting->result = isatty(fd); + semihosting->sys_errno = errno; LOG_DEBUG("isatty(%d)=%d", fd, (int)semihosting->result); } break;