From: kaf24@localhost.localdomain Date: Mon, 28 Aug 2006 11:50:55 +0000 (+0100) Subject: The following patch fixes a bug where xenconsoled will can SEGV X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15681^2~5 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=2b1e704734e09cb2b778146bce9111123f822bbe;p=xen.git The following patch fixes a bug where xenconsoled will can SEGV because it uses FD_ISSET(-1,xxx). Since the code is written that any ring/tty handler can set d->tty_fd to -1 it has to be checked _every_time_. Signed-off-by: Jimi Xenidis --- diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index 5c0eaa0d9d..93f96b101d 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -584,16 +584,14 @@ void handle_io(void) FD_ISSET(xc_evtchn_fd(d->xce_handle), &readfds)) handle_ring_read(d); - if (d->tty_fd != -1) { - if (FD_ISSET(d->tty_fd, &readfds)) - handle_tty_read(d); + if (d->tty_fd != -1 && FD_ISSET(d->tty_fd, &readfds)) + handle_tty_read(d); - if (FD_ISSET(d->tty_fd, &writefds)) - handle_tty_write(d); + if (d->tty_fd != -1 && FD_ISSET(d->tty_fd, &writefds)) + handle_tty_write(d); - if (d->is_dead) - cleanup_domain(d); - } + if (d->is_dead) + cleanup_domain(d); } } while (ret > -1); }