From patchwork Thu Nov 10 12:41:48 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 124878 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B0C9BB6F84 for ; Fri, 11 Nov 2011 00:43:03 +1100 (EST) Received: from localhost ([::1]:36184 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROTz3-0008Rl-Lc for incoming@patchwork.ozlabs.org; Thu, 10 Nov 2011 07:43:57 -0500 Received: from eggs.gnu.org ([140.186.70.92]:58393) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROTya-0006lC-0Z for qemu-devel@nongnu.org; Thu, 10 Nov 2011 07:43:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ROTyU-0006rk-Ah for qemu-devel@nongnu.org; Thu, 10 Nov 2011 07:43:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:18590) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROTyT-0006r1-TH for qemu-devel@nongnu.org; Thu, 10 Nov 2011 07:43:22 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pAAChJNK010606 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 10 Nov 2011 07:43:20 -0500 Received: from blackpad.lan.raisama.net (ovpn-113-78.phx2.redhat.com [10.3.113.78]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id pAAChJ8R014245; Thu, 10 Nov 2011 07:43:19 -0500 Received: by blackpad.lan.raisama.net (Postfix, from userid 500) id 7A4FB204F95; Thu, 10 Nov 2011 10:41:49 -0200 (BRST) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Thu, 10 Nov 2011 10:41:48 -0200 Message-Id: <1320928908-19076-11-git-send-email-ehabkost@redhat.com> In-Reply-To: <1320928908-19076-1-git-send-email-ehabkost@redhat.com> References: <1320928908-19076-1-git-send-email-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 209.132.183.28 Cc: Michael Roth , Juan Quintela Subject: [Qemu-devel] [PATCH 10/10] unix_close(): check for close() errors too (v2) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org In case close() fails, we want to report the error back. Changes v1 -> v2: - Use braces on if statement to match coding style Signed-off-by: Eduardo Habkost --- migration-unix.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/migration-unix.c b/migration-unix.c index 8596353..dfcf203 100644 --- a/migration-unix.c +++ b/migration-unix.c @@ -40,12 +40,15 @@ static int unix_write(MigrationState *s, const void * buf, size_t size) static int unix_close(MigrationState *s) { + int r = 0; DPRINTF("unix_close\n"); if (s->fd != -1) { - close(s->fd); + if (close(s->fd) < 0) { + r = -errno; + } s->fd = -1; } - return 0; + return r; } static void unix_wait_for_connect(void *opaque)