ia64/xen-unstable

changeset 11314:c61b8296b39a

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>
author kaf24@localhost.localdomain
date Mon Aug 28 12:50:55 2006 +0100 (2006-08-28)
parents 439fa5d6c5ce
children 028862ea9c9d
files tools/console/daemon/io.c
line diff
     1.1 --- a/tools/console/daemon/io.c	Mon Aug 28 12:49:14 2006 +0100
     1.2 +++ b/tools/console/daemon/io.c	Mon Aug 28 12:50:55 2006 +0100
     1.3 @@ -584,16 +584,14 @@ void handle_io(void)
     1.4  			    FD_ISSET(xc_evtchn_fd(d->xce_handle), &readfds))
     1.5  				handle_ring_read(d);
     1.6  
     1.7 -			if (d->tty_fd != -1) {
     1.8 -				if (FD_ISSET(d->tty_fd, &readfds))
     1.9 -					handle_tty_read(d);
    1.10 +			if (d->tty_fd != -1 && FD_ISSET(d->tty_fd, &readfds))
    1.11 +				handle_tty_read(d);
    1.12  
    1.13 -				if (FD_ISSET(d->tty_fd, &writefds))
    1.14 -					handle_tty_write(d);
    1.15 +			if (d->tty_fd != -1 && FD_ISSET(d->tty_fd, &writefds))
    1.16 +				handle_tty_write(d);
    1.17  
    1.18 -				if (d->is_dead)
    1.19 -					cleanup_domain(d);
    1.20 -			}
    1.21 +			if (d->is_dead)
    1.22 +				cleanup_domain(d);
    1.23  		}
    1.24  	} while (ret > -1);
    1.25  }