]> xenbits.xensource.com Git - libvirt.git/commit
virPortAllocatorSetUsed: ignore port 0
authorJán Tomko <jtomko@redhat.com>
Mon, 21 Jan 2019 14:49:23 +0000 (15:49 +0100)
committerJán Tomko <jtomko@redhat.com>
Fri, 25 Jan 2019 13:50:05 +0000 (14:50 +0100)
commitc2a8256991d772323a3df08c33b012bf12d62645
treeb494d490a4a97c2cfd2633e8f6d7e041ae2b73a8
parent872b15dea6623490c223b0c8081e14f280459a60
virPortAllocatorSetUsed: ignore port 0

Similar to what commit 86dba8f3 did for virPortAllocatorRelease,
ignore port 0 in virPortAllocatorSetUsed.

For all the reasonable use cases the callers already check that
the port is non-zero, however if the port from the XML overflows
unsigned short and turns into 0, it can be set as used by
virPortAllocatorSetUsed but not released by virPortAllocatorRelease.

Also skip port '0' in virPortAllocatorSetUsed to make this behavior
symmetric.

The serenity was disturbed by commit 5dbda5e9 which started using
virPortAllocatorRelease instead of virPortAllocatorSetUsed (false).

https://bugzilla.redhat.com/show_bug.cgi?id=1591645

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
src/util/virportallocator.c