From: Jan Matyas Date: Fri, 4 Jun 2021 09:41:36 +0000 (+0200) Subject: target/semihosting: Capture errno in SEMIHOSTING_SYS_ISTTY X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=4487270ea434782f25f790892c5f7d03b7cbe243;p=fw%2Fopenocd 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 --- 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;