summaryrefslogtreecommitdiff
path: root/migration-tcp.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-10-03 14:34:33 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2012-10-23 13:54:55 +0200
commitbe7059cd7f8998d41f0b44ec13907359d04c63d2 (patch)
treef5bb02993846ff5c8ac5338f2dfaa6f09dd4afff /migration-tcp.c
parent1fc05adfa0f79a1268f7c2b7fb324f15eb63dceb (diff)
downloadqemu-be7059cd7f8998d41f0b44ec13907359d04c63d2.tar.gz
migration: avoid using error_is_set and thus relying on errp != NULL
The migration code is using errp to detect "internal" errors, this means that it relies on errp being non-NULL. No impact so far because our only QMP clients (the QMP marshaller and HMP) never pass a NULL Error **. But if we had others, this patch would make sure that migration can work with a NULL Error **. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'migration-tcp.c')
-rw-r--r--migration-tcp.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/migration-tcp.c b/migration-tcp.c
index a15c2b87a1..78337a3e29 100644
--- a/migration-tcp.c
+++ b/migration-tcp.c
@@ -71,14 +71,16 @@ static void tcp_wait_for_connect(int fd, void *opaque)
int tcp_start_outgoing_migration(MigrationState *s, const char *host_port,
Error **errp)
{
+ Error *local_err = NULL;
+
s->get_error = socket_errno;
s->write = socket_write;
s->close = tcp_close;
- s->fd = inet_nonblocking_connect(host_port, tcp_wait_for_connect, s,
- errp);
- if (error_is_set(errp)) {
+ s->fd = inet_nonblocking_connect(host_port, tcp_wait_for_connect, s, &local_err);
+ if (local_err != NULL) {
migrate_fd_error(s);
+ error_propagate(errp, local_err);
return -1;
}