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

Signed-off-by: Eduardo Habkost <ehabk...@redhat.com>
---
 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