]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: fix success return from qemuDomainGetHostnameLease master
authorRoman Bogorodskiy <bogorodskiy@gmail.com>
Sat, 11 Apr 2026 13:28:55 +0000 (15:28 +0200)
committerRoman Bogorodskiy <bogorodskiy@gmail.com>
Tue, 14 Apr 2026 17:09:06 +0000 (19:09 +0200)
commit80fb188790d3b75bc58f8feb83d6ed8ceda5c17e
tree9d187c0a593e40ed3ed68f6ec03f514b3cfab2a1
parent47e9e16100d026a6da9835f9f746bdc481e8b91f
qemu: fix success return from qemuDomainGetHostnameLease

The current qemuDomainGetHostnameLease() implementation
jumps to the "endjob" label when it finds hostname.
As the label is defined after "ret = 0",
qemuDomainGetHostnameLease() returns -1 in this case.

That works because in qemuDomainGetHostname() it is used like that:

...
       if (qemuDomainGetHostnameLease(vm, &hostname) < 0)
           goto cleanup;

...

   cleanup:
      virDomainObjEndAPI(&vm);
      return hostname;
  }

So it works, but it looks confusing. To make more consistent,
use 'break' in qemuDomainGetHostnameLease() when the hostname
is found, so it returns 0 in this case.

Fixes: a4a5827c9fc396f2b1848c1d393385535b106d1a
Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/qemu/qemu_driver.c