From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:35092) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLJuM-0002nS-Ci for qemu-devel@nongnu.org; Tue, 01 Nov 2011 15:22:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RLJuH-00087e-LK for qemu-devel@nongnu.org; Tue, 01 Nov 2011 15:22:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:3780) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLJuH-00086o-D2 for qemu-devel@nongnu.org; Tue, 01 Nov 2011 15:21:57 -0400 From: Eduardo Habkost Date: Tue, 1 Nov 2011 17:20:28 -0200 Message-Id: <1320175230-27980-10-git-send-email-ehabkost@redhat.com> In-Reply-To: <1320175230-27980-1-git-send-email-ehabkost@redhat.com> References: <1320175230-27980-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [RFC PATCH 09/11] fd_close(): check for close() errors too List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Michael Roth , Juan Quintela In case close() fails, we want to report the error back. Signed-off-by: Eduardo Habkost --- migration-fd.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/migration-fd.c b/migration-fd.c index d0aec89..4d86d43 100644 --- a/migration-fd.c +++ b/migration-fd.c @@ -42,12 +42,14 @@ static int fd_write(MigrationState *s, const void * buf, size_t size) static int fd_close(MigrationState *s) { + int r = 0; DPRINTF("fd_close\n"); if (s->fd != -1) { - close(s->fd); + if (close(s->fd) < 0) + r = -errno; s->fd = -1; } - return 0; + return r; } int fd_start_outgoing_migration(MigrationState *s, const char *fdname) -- 1.7.3.2