aboutsummaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authorCorey Bryant <coreyb@linux.vnet.ibm.com>2012-10-18 15:19:33 -0400
committerKevin Wolf <kwolf@redhat.com>2012-10-24 10:26:19 +0200
commitebe52b592dd5867fce7238f49b8c0416c3eedb6c (patch)
treeb9ada7102011fd42931b981a3c03b611f50dc106 /monitor.c
parente446f70d54b4920e8ca5af509271b69eab86e37b (diff)
downloadqemu-ebe52b592dd5867fce7238f49b8c0416c3eedb6c.zip
qemu-ebe52b592dd5867fce7238f49b8c0416c3eedb6c.tar.gz
qemu-ebe52b592dd5867fce7238f49b8c0416c3eedb6c.tar.bz2
monitor: Prevent removing fd from set during init
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>
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/monitor.c b/monitor.c
index 6e99049..1d3dd9a 100644
--- 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);