diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-10-03 14:34:33 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2012-10-23 13:54:55 +0200 |
commit | be7059cd7f8998d41f0b44ec13907359d04c63d2 (patch) | |
tree | f5bb02993846ff5c8ac5338f2dfaa6f09dd4afff /migration.c | |
parent | 1fc05adfa0f79a1268f7c2b7fb324f15eb63dceb (diff) | |
download | qemu-be7059cd7f8998d41f0b44ec13907359d04c63d2.zip qemu-be7059cd7f8998d41f0b44ec13907359d04c63d2.tar.gz qemu-be7059cd7f8998d41f0b44ec13907359d04c63d2.tar.bz2 |
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.c')
-rw-r--r-- | migration.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/migration.c b/migration.c index 62e0304..b332dae 100644 --- a/migration.c +++ b/migration.c @@ -483,6 +483,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, bool has_inc, bool inc, bool has_detach, bool detach, Error **errp) { + Error *local_err = NULL; MigrationState *s = migrate_get_current(); MigrationParams params; const char *p; @@ -508,7 +509,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, s = migrate_init(¶ms); if (strstart(uri, "tcp:", &p)) { - ret = tcp_start_outgoing_migration(s, p, errp); + ret = tcp_start_outgoing_migration(s, p, &local_err); #if !defined(WIN32) } else if (strstart(uri, "exec:", &p)) { ret = exec_start_outgoing_migration(s, p); @@ -522,11 +523,11 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, return; } - if (ret < 0) { - if (!error_is_set(errp)) { - DPRINTF("migration failed: %s\n", strerror(-ret)); - /* FIXME: we should return meaningful errors */ - error_set(errp, QERR_UNDEFINED_ERROR); + if (ret < 0 || local_err) { + if (!local_err) { + error_set_errno(errp, -ret, QERR_UNDEFINED_ERROR); + } else { + error_propagate(errp, local_err); } return; } |