aboutsummaryrefslogtreecommitdiffstats
path: root/tools/console
diff options
context:
space:
mode:
authorkaf24@localhost.localdomain <kaf24@localhost.localdomain>2006-08-28 12:50:55 +0100
committerkaf24@localhost.localdomain <kaf24@localhost.localdomain>2006-08-28 12:50:55 +0100
commit2b1e704734e09cb2b778146bce9111123f822bbe (patch)
tree759ba9db0d7a5e7bbbb7e36e0a4a852644f54317 /tools/console
parenta1a3b44764a5e0ba57baf00336e5942a45670ec0 (diff)
downloadxen-2b1e704734e09cb2b778146bce9111123f822bbe.tar.gz
xen-2b1e704734e09cb2b778146bce9111123f822bbe.tar.bz2
xen-2b1e704734e09cb2b778146bce9111123f822bbe.zip
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 <jimix@watson.ibm.com>
Diffstat (limited to 'tools/console')
-rw-r--r--tools/console/daemon/io.c14
1 files changed, 6 insertions, 8 deletions
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);
}