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 <matyas@codasip.com>
Reviewed-on: http://openocd.zylin.com/6292
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Jan Matyas 2021-06-04 11:41:36 +02:00 committed by Antonio Borneo
parent 554878b9d3
commit 4487270ea4
1 changed files with 1 additions and 0 deletions

View File

@ -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;