[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 007/124] vmstate: Return error in case of error
From: |
Juan Quintela |
Subject: |
Re: [Qemu-devel] [PATCH 007/124] vmstate: Return error in case of error |
Date: |
Tue, 22 Apr 2014 13:54:22 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
"Dr. David Alan Gilbert" <address@hidden> wrote:
> * Juan Quintela (address@hidden) wrote:
>> 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 <address@hidden>
>> ---
>> vmstate.c | 6 ++++++
>> 1 file changed, 6 insertions(+)
>>
>> diff --git a/vmstate.c b/vmstate.c
>> index bfa34cc..bcf1cde 100644
>> --- a/vmstate.c
>> +++ b/vmstate.c
>> @@ -74,7 +74,13 @@ int vmstate_load_state(QEMUFile *f, const
>> VMStateDescription *vmsd,
>> ret = field->info->get(f, addr, size);
>>
>> }
>> + if (ret >= 0) {
>> + ret = qemu_file_get_error(f);
>> + }
>> if (ret < 0) {
>> + if (!qemu_file_get_error(f)) {
>> + qemu_file_set_error(f, ret);
>> + }
>
> qemu_file_set_error already checks for an existing error, so
> you don't need that check.
ret could already be less than zero and qemu_file error not being set
yet. Problem found during testing. That is the reason that I have to
"improve" the previous patch.
Later, Juan.
>
> Dve
>
>> trace_vmstate_load_field_error(field->name, ret);
>> return ret;
>> }
>> --
>> 1.9.0
>>
>>
> --
> Dr. David Alan Gilbert / address@hidden / Manchester, UK
- Re: [Qemu-devel] [PATCH 002/124] savevm: Remove all the unneded version_minimum_id_old (usb), (continued)
[Qemu-devel] [PATCH 008/124] vmstate: Reduce code duplication, Juan Quintela, 2014/04/21
[Qemu-devel] [PATCH 009/124] vmstate: Refactor opening of files, Juan Quintela, 2014/04/21
[Qemu-devel] [PATCH 010/124] vmstate: Refactor & increase tests for primitive types, Juan Quintela, 2014/04/21