From 8160bfbc4d5d0abf78afa557f2d5832dc11cd690 Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Thu, 10 Nov 2011 10:41:48 -0200 Subject: 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 Signed-off-by: Anthony Liguori --- migration-unix.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'migration-unix.c') 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) -- cgit v1.2.1