]> git.proxmox.com Git - qemu.git/commitdiff
monitor: Prevent removing fd from set during init
authorCorey Bryant <coreyb@linux.vnet.ibm.com>
Thu, 18 Oct 2012 19:19:33 +0000 (15:19 -0400)
committerKevin Wolf <kwolf@redhat.com>
Wed, 24 Oct 2012 08:26:19 +0000 (10:26 +0200)
If an fd is added to an fd set via the command line, and it is not
referenced by another command line option (ie. -drive), then clean
it up after QEMU initialization is complete.

Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
monitor.c

index 6e990496a8ac520d11314c5ce797953196e69f14..1d3dd9aac198f476bd01c570332698b36f7e1db6 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -2105,8 +2105,9 @@ static void monitor_fdset_cleanup(MonFdset *mon_fdset)
     MonFdsetFd *mon_fdset_fd_next;
 
     QLIST_FOREACH_SAFE(mon_fdset_fd, &mon_fdset->fds, next, mon_fdset_fd_next) {
-        if (mon_fdset_fd->removed ||
-                (QLIST_EMPTY(&mon_fdset->dup_fds) && mon_refcount == 0)) {
+        if ((mon_fdset_fd->removed ||
+                (QLIST_EMPTY(&mon_fdset->dup_fds) && mon_refcount == 0)) &&
+                runstate_is_running()) {
             close(mon_fdset_fd->fd);
             g_free(mon_fdset_fd->opaque);
             QLIST_REMOVE(mon_fdset_fd, next);