qemu vnc auth 1/4: QEMU event handler bug fix
authorKeir Fraser <keir@xensource.com>
Tue, 30 Oct 2007 09:22:27 +0000 (09:22 +0000)
committerKeir Fraser <keir@xensource.com>
Tue, 30 Oct 2007 09:22:27 +0000 (09:22 +0000)
This patch pulls in an upstream QEMU fix for dealing with a problem in
the event dispatcher where a write callback gets unregistered while a
write event is pending from poll. Without this the QEMU process with
deference a NULL pointer and crash.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
tools/ioemu/vl.c

index 1187f0cd3946d5bcd567a20ff141df867bd26a50..f3abe2ed05fd06b446b323c53f67434744ee417a 100644 (file)
@@ -6203,12 +6203,10 @@ void main_loop_wait(int timeout)
         IOHandlerRecord **pioh;
 
         for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) {
-            if (ioh->deleted)
-                continue;
-            if (ioh->fd_read && FD_ISSET(ioh->fd, &rfds)) {
+            if (!ioh->deleted && ioh->fd_read && FD_ISSET(ioh->fd, &rfds)) {
                 ioh->fd_read(ioh->opaque);
             }
-            if (ioh->fd_write && FD_ISSET(ioh->fd, &wfds)) {
+            if (!ioh->deleted && ioh->fd_write && FD_ISSET(ioh->fd, &wfds)) {
                 ioh->fd_write(ioh->opaque);
             }
         }