qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH 09/11] fd_close(): check for close() errors too


From: Eduardo Habkost
Subject: [Qemu-devel] [RFC PATCH 09/11] fd_close(): check for close() errors too
Date: Tue, 1 Nov 2011 17:20:28 -0200

In case close() fails, we want to report the error back.

Signed-off-by: Eduardo Habkost <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]