[libvirt] [PATCH 3/3] Fix race in finding available vnc port
Eric Blake
eblake at redhat.com
Thu May 20 23:25:26 UTC 2010
On 05/20/2010 02:45 PM, Jim Fehlig wrote:
> for (i = QEMU_VNC_PORT_MIN; i < QEMU_VNC_PORT_MAX; i++) {
> int fd;
> int reuse = 1;
> struct sockaddr_in addr;
> + bool used = false;
> +
> + virBitmapGetBit(driver->reservedVNCPorts, i - QEMU_VNC_PORT_MIN, &used);
For now, we're safe not checking for failure here. But maybe we should
add an error check and a VIR_DEBUG to be proactive in case the size of
driver->reservedVNCPorts is ever accidentally changed? (Hmm, maybe an
addendum to my comments on 1/3, that the bitmap.h file should mark
functions as ATTRIBUTE_RETURN_CHECK?) I could go either way, so for
now, I'll wait for other comments (and for the fixes to bitmap.h) before
giving an ack.
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100520/5b7adba8/attachment-0001.sig>
More information about the libvir-list
mailing list