[RFC,09/11] fd_close(): check for close() errors too
diff mbox

Message ID 1320175230-27980-10-git-send-email-ehabkost@redhat.com
State New
Headers show

Commit Message

Eduardo Habkost Nov. 1, 2011, 7:20 p.m. UTC
In case close() fails, we want to report the error back.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 migration-fd.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

Patch
diff mbox

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)