From 9332e174882533bc040dd83e94818f3807ce9210 Mon Sep 17 00:00:00 2001 From: cperciva Date: Thu, 6 Jan 2011 22:54:48 +0000 Subject: [PATCH] MFS r217053: Fix the Xen console to not spew \0 bytes when there is no input available. Approved by: re (rwatson) git-svn-id: svn://svn.freebsd.org/base/releng/8.2@217082 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/dev/xen/console/console.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/dev/xen/console/console.c b/sys/dev/xen/console/console.c index 44a4fb35..4b624ee2 100644 --- a/sys/dev/xen/console/console.c +++ b/sys/dev/xen/console/console.c @@ -145,17 +145,18 @@ xccngetc(struct consdev *dev) int xccncheckc(struct consdev *dev) { - int ret = (xc_mute ? 0 : -1); + int ret; if (xencons_has_input()) xencons_handle_input(NULL); CN_LOCK(cn_mtx); - if ((rp - rc)) { + if ((rp - rc) && !xc_mute) { /* we need to return only one char */ ret = (int)rbuf[RBUF_MASK(rc)]; rc++; - } + } else + ret = -1; CN_UNLOCK(cn_mtx); return(ret); } -- 2.42.0