[libvirt] [PATCH] qemu: return -1 on error paths in qemuDomainSaveImageStartVM

The error paths after fix suppose ret == -1 as at the beginning of the function. The better fix would be not to touch 'ret' at all until the end of the function where it is set to 0. Thus we'd better introduce some 'rc' variable to hold return values of called functions. --- src/qemu/qemu_driver.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 351e529..dfbf846 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6790,6 +6790,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn, virDomainAuditStart(vm, "restored", false); goto cleanup; } + ret = -1; event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED, -- 1.8.3.1

On Thu, Jan 28, 2016 at 15:49:48 +0300, Nikolay Shirokovskiy wrote:
The error paths after fix suppose ret == -1 as at the beginning of the function.
The better fix would be not to touch 'ret' at all until the end of the function where it is set to 0. Thus we'd better introduce some 'rc' variable to hold return values of called functions.
Exactly, it would be much better the way you describe, so why didn't you do it that way? :-) NACK to this patch. Jirka

On 28.01.2016 16:27, Jiri Denemark wrote:
On Thu, Jan 28, 2016 at 15:49:48 +0300, Nikolay Shirokovskiy wrote:
The error paths after fix suppose ret == -1 as at the beginning of the function.
The better fix would be not to touch 'ret' at all until the end of the function where it is set to 0. Thus we'd better introduce some 'rc' variable to hold return values of called functions.
Exactly, it would be much better the way you describe, so why didn't you do it that way? :-) Ok)
NACK to this patch.
Jirka
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
participants (2)
-
Jiri Denemark
-
Nikolay Shirokovskiy