From a65ea94c56e0d2fcec920971c24b692910dadc36 Mon Sep 17 00:00:00 2001 From: Leandro Lupori Date: Thu, 4 Jul 2019 12:40:38 +0000 Subject: [PATCH] MFC r349188 [PPC] Fix loader input with newer QEMU versions At least since version 4.0.0, QEMU became bug-compatible with PowerVM's vty, by inserting a \0 after every \r. As this confuses loader's interpreter and as a \0 coming from the console doesn't seem reasonable, it's now being filtered at OFW console input. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D20676 --- stand/ofw/libofw/ofw_console.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/stand/ofw/libofw/ofw_console.c b/stand/ofw/libofw/ofw_console.c index 59ce9a5067d..a129997c5df 100644 --- a/stand/ofw/libofw/ofw_console.c +++ b/stand/ofw/libofw/ofw_console.c @@ -97,7 +97,11 @@ ofw_cons_getchar() return l; } - if (OF_read(stdin, &ch, 1) > 0) + /* At least since version 4.0.0, QEMU became bug-compatible + * with PowerVM's vty, by inserting a \0 after every \r. + * As this confuses loader's interpreter and as a \0 coming + * from the console doesn't seem reasonable, it's filtered here. */ + if (OF_read(stdin, &ch, 1) > 0 && ch != '\0') return (ch); return (-1); -- 2.45.0