qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 10/10] unix_close(): check for close() errors too (v


From: Eduardo Habkost
Subject: [Qemu-devel] [PATCH 10/10] unix_close(): check for close() errors too (v2)
Date: Thu, 10 Nov 2011 10:41:48 -0200

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 <address@hidden>
---
 migration-unix.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/migration-unix.c b/migration-unix.c
index 8596353..dfcf203 100644
--- a/migration-unix.c
+++ b/migration-unix.c
@@ -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)
-- 
1.7.3.2




reply via email to

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