]> git.proxmox.com Git - qemu.git/commitdiff
unix_close(): check for close() errors too (v2)
authorEduardo Habkost <ehabkost@redhat.com>
Thu, 10 Nov 2011 12:41:48 +0000 (10:41 -0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Mon, 12 Dec 2011 17:47:20 +0000 (11:47 -0600)
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 <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
migration-unix.c

index 8596353d7d071afa8bfedb26fa32f697706258bb..dfcf2033c69d47784c62c6b3f11e465a8deb90f9 100644 (file)
@@ -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)