aboutsummaryrefslogtreecommitdiff
path: root/semihosting
diff options
context:
space:
mode:
Diffstat (limited to 'semihosting')
-rw-r--r--semihosting/console.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/semihosting/console.c b/semihosting/console.c
index 5b1ec0a1c3..0f976fe8cb 100644
--- a/semihosting/console.c
+++ b/semihosting/console.c
@@ -111,7 +111,8 @@ int qemu_semihosting_console_read(CPUState *cs, void *buf, int len)
int qemu_semihosting_console_write(void *buf, int len)
{
if (console.chr) {
- return qemu_chr_write_all(console.chr, (uint8_t *)buf, len);
+ int r = qemu_chr_write_all(console.chr, (uint8_t *)buf, len);
+ return r < 0 ? 0 : r;
} else {
return fwrite(buf, 1, len, stderr);
}