diff options
Diffstat (limited to 'migration/qemu-file.c')
-rw-r--r-- | migration/qemu-file.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 1e80d49..2f266b2 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -161,6 +161,33 @@ int qemu_file_get_error_obj(QEMUFile *f, Error **errp) } /* + * Get last error for either stream f1 or f2 with optional Error*. + * The error returned (non-zero) can be either from f1 or f2. + * + * If any of the qemufile* is NULL, then skip the check on that file. + * + * When there is no error on both qemufile, zero is returned. + */ +int qemu_file_get_error_obj_any(QEMUFile *f1, QEMUFile *f2, Error **errp) +{ + int ret = 0; + + if (f1) { + ret = qemu_file_get_error_obj(f1, errp); + /* If there's already error detected, return */ + if (ret) { + return ret; + } + } + + if (f2) { + ret = qemu_file_get_error_obj(f2, errp); + } + + return ret; +} + +/* * Set the last error for stream f with optional Error* */ void qemu_file_set_error_obj(QEMUFile *f, int ret, Error *err) |