From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:44300) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOBsc-0000vg-HE for qemu-devel@nongnu.org; Tue, 16 Oct 2012 14:28:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TOBsb-0006JG-Fk for qemu-devel@nongnu.org; Tue, 16 Oct 2012 14:28:38 -0400 Received: from e6.ny.us.ibm.com ([32.97.182.146]:53898) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOBsb-0006J8-Bt for qemu-devel@nongnu.org; Tue, 16 Oct 2012 14:28:37 -0400 Received: from /spool/local by e6.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 16 Oct 2012 14:28:35 -0400 Received: from d01relay03.pok.ibm.com (d01relay03.pok.ibm.com [9.56.227.235]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id B409D38C859C for ; Tue, 16 Oct 2012 14:08:47 -0400 (EDT) Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay03.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q9GI8gnx280026 for ; Tue, 16 Oct 2012 14:08:42 -0400 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q9GI8fDN014648 for ; Tue, 16 Oct 2012 14:08:42 -0400 From: Corey Bryant Date: Tue, 16 Oct 2012 14:08:32 -0400 Message-Id: <1350410912-2373-1-git-send-email-coreyb@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH v3 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 --- v3: - This patch was split into it's own patch in v3 (eblake@redhat.com, kwolf@redhat.com) monitor.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/monitor.c b/monitor.c index 5d5de41..0dae7ac 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