Received: from eggs.gnu.org ([208.118.235.92]:48326) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOvdP-00009X-Il for qemu-devel@nongnu.org; Thu, 18 Oct 2012 15:20:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TOvdL-00050J-E5 for qemu-devel@nongnu.org; Thu, 18 Oct 2012 15:19:59 -0400 Received: from e33.co.us.ibm.com ([32.97.110.151]:48579) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOvdL-000506-5I for qemu-devel@nongnu.org; Thu, 18 Oct 2012 15:19:55 -0400 Received: from /spool/local by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 18 Oct 2012 13:19:52 -0600 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id EE6D319D805C for ; Thu, 18 Oct 2012 13:19:47 -0600 (MDT) Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q9IJJlV5223674 for ; Thu, 18 Oct 2012 13:19:47 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q9IJJhWV021359 for ; Thu, 18 Oct 2012 13:19:44 -0600 From: Corey Bryant Date: Thu, 18 Oct 2012 15:19:33 -0400 Message-Id: <1350587974-6378-4-git-send-email-coreyb@linux.vnet.ibm.com> In-Reply-To: <1350587974-6378-1-git-send-email-coreyb@linux.vnet.ibm.com> References: <1350587974-6378-1-git-send-email-coreyb@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH v4 3/4] monitor: Prevent removing fd from set during init List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, libvir-list@redhat.com, Corey Bryant 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 Reviewed-by: Eric Blake --- v3: - This patch was split into it's own patch in v3 (eblake@redhat.com, kwolf@redhat.com) v4: - No changes monitor.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/monitor.c b/monitor.c index d8f66ca..928e3ae 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); -- 1.7.11.4