From patchwork Sat Jul 24 10:03:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shahar Havivi X-Patchwork-Id: 59853 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id DF8F5B6F10 for ; Sat, 24 Jul 2010 20:09:52 +1000 (EST) Received: from localhost ([127.0.0.1]:33055 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OcbeM-00081f-GO for incoming@patchwork.ozlabs.org; Sat, 24 Jul 2010 06:08:10 -0400 Received: from [140.186.70.92] (port=45112 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ocbd8-0007kz-59 for qemu-devel@nongnu.org; Sat, 24 Jul 2010 06:06:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ocbd2-0004wD-1a for qemu-devel@nongnu.org; Sat, 24 Jul 2010 06:06:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:15050) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ocbd1-0004vx-RF for qemu-devel@nongnu.org; Sat, 24 Jul 2010 06:06:48 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o6OA6jFs022726 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 24 Jul 2010 06:06:45 -0400 Received: from localhost (dhcp-1-229.tlv.redhat.com [10.35.1.229]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o6OA6hbN014710 for ; Sat, 24 Jul 2010 06:06:44 -0400 Date: Sat, 24 Jul 2010 13:03:07 +0300 From: Shahar Havivi To: qemu-devel@nongnu.org Message-ID: <20100724100303.GA23454@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-12-10) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH] Close socket file descriptor when qemu_accept fails X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Shahar Havivi --- migration-tcp.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/migration-tcp.c b/migration-tcp.c index 78b56dc..b55f419 100644 --- a/migration-tcp.c +++ b/migration-tcp.c @@ -151,7 +151,7 @@ static void tcp_accept_incoming_migration(void *opaque) if (c == -1) { fprintf(stderr, "could not accept migration connection\n"); - return; + goto out2; } f = qemu_fopen_socket(c); @@ -163,9 +163,10 @@ static void tcp_accept_incoming_migration(void *opaque) process_incoming_migration(f); qemu_fclose(f); out: + close(c); +out2: qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL); close(s); - close(c); } int tcp_start_incoming_migration(const char *host_port)