aboutsummaryrefslogtreecommitdiff
path: root/migration-unix.c
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2011-11-10 10:41:48 -0200
committerAnthony Liguori <aliguori@us.ibm.com>2011-12-12 11:47:20 -0600
commit8160bfbc4d5d0abf78afa557f2d5832dc11cd690 (patch)
tree7a502c8e02a593d52dc32a8907321c94e83f09e1 /migration-unix.c
parent61a5872fd66be718ad022102bf813d7e4e9324c5 (diff)
downloadqemu-arm-8160bfbc4d5d0abf78afa557f2d5832dc11cd690.tar.gz
unix_close(): check for close() errors too (v2)
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>
Diffstat (limited to 'migration-unix.c')
-rw-r--r--migration-unix.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/migration-unix.c b/migration-unix.c
index 8596353d7d..dfcf2033c6 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)