From: ths Date: Sat, 25 Aug 2007 01:34:19 +0000 (+0000) Subject: Avoid SEGV in IOHandler dispatch, by Daniel P. Berrange. X-Git-Tag: xen-3.3.0-rc1~1227 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=6ab43fdc31e25b114eec1f3ee25264b5f6a1a0f3;p=qemu-xen-4.0-testing.git Avoid SEGV in IOHandler dispatch, by Daniel P. Berrange. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3132 c046a42c-6fe2-441c-8c8c-71466251a162 --- diff --git a/vl.c b/vl.c index 9bcffc01..9009ce58 100644 --- a/vl.c +++ b/vl.c @@ -6823,12 +6823,10 @@ void main_loop_wait(int timeout) IOHandlerRecord **pioh; for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) { - if (ioh->deleted) - continue; - if (FD_ISSET(ioh->fd, &rfds)) { + if (!ioh->deleted && ioh->fd_read && FD_ISSET(ioh->fd, &rfds)) { ioh->fd_read(ioh->opaque); } - if (FD_ISSET(ioh->fd, &wfds)) { + if (!ioh->deleted && ioh->fd_write && FD_ISSET(ioh->fd, &wfds)) { ioh->fd_write(ioh->opaque); } }