vmstate: Return error in case of error
If there is an error while loading a field, we should stop reading and not continue with the rest of fields. And we should also set an error in qemu_file. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
parent
25feab2fc2
commit
13cde50889
@ -98,7 +98,11 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
|
|||||||
ret = field->info->get(f, addr, size);
|
ret = field->info->get(f, addr, size);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (ret >= 0) {
|
||||||
|
ret = qemu_file_get_error(f);
|
||||||
|
}
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
qemu_file_set_error(f, ret);
|
||||||
trace_vmstate_load_field_error(field->name, ret);
|
trace_vmstate_load_field_error(field->name, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user