aboutsummaryrefslogtreecommitdiff
path: root/migration-tcp.c
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2011-11-10 10:41:47 -0200
committerAnthony Liguori <aliguori@us.ibm.com>2011-12-12 11:47:20 -0600
commit61a5872fd66be718ad022102bf813d7e4e9324c5 (patch)
tree25468b5ccda7e962bb4beb043cdf642f943b81a5 /migration-tcp.c
parente375fe3472f6d64971d3bd8e10a3f159e72435a1 (diff)
downloadqemu-61a5872fd66be718ad022102bf813d7e4e9324c5.zip
qemu-61a5872fd66be718ad022102bf813d7e4e9324c5.tar.gz
qemu-61a5872fd66be718ad022102bf813d7e4e9324c5.tar.bz2
tcp_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-tcp.c')
-rw-r--r--migration-tcp.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/migration-tcp.c b/migration-tcp.c
index 5aa742c..cf6a9b8 100644
--- a/migration-tcp.c
+++ b/migration-tcp.c
@@ -40,12 +40,15 @@ static int socket_write(MigrationState *s, const void * buf, size_t size)
static int tcp_close(MigrationState *s)
{
+ int r = 0;
DPRINTF("tcp_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 tcp_wait_for_connect(void *opaque)