From eb68ccd676774c4be94deb11b56ced0889f15ea6 Mon Sep 17 00:00:00 2001 From: Colin Percival Date: Wed, 29 Dec 2010 05:13:21 +0000 Subject: [PATCH] A lack of console input is not the same thing as a byte of \0 input. Correctly return -1 from cngetc when no input is available to be read. This fixes the '(CTRL-C to abort)' spam while dumping. MFC after: 3 days --- 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 8f765e20c65..d6140828480 100644 --- a/sys/dev/xen/console/console.c +++ b/sys/dev/xen/console/console.c @@ -125,17 +125,18 @@ xc_cnterm(struct consdev *cp) static int xc_cngetc(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.45.2