On Wed, Jun 30, 2021 at 08:37:46PM +0100, Richard W.M. Jones wrote:
Because I forgot to use the NI_NUMERICSERV flag, getnameinfo would
translate the port number into a service name (when possible) using
/etc/services. This is not really desirable since raw port numbers
are more portable and descriptive. This also caused occasional test
failures when pick-a-port happened to pick a port number which
coincided with a service name.
This commit also adds a test. Previous to the fix, the test failed with:
$ ./run tests/aio-connect-port
tests/.libs/aio-connect-port: actual URI nbd://127.0.0.1:sieve-filter/ != expected URI
nbd://127.0.0.1:2000/
This test cannot be run as part of the test suite because it requires
a fixed port number.
See also
https://listman.redhat.com/archives/libguestfs/2021-June/msg00205.html
Reported-by: Martin Kletzander
---
.gitignore | 1 +
lib/uri.c | 3 +-
tests/Makefile.am | 9 +++
tests/aio-connect-port.c | 128 +++++++++++++++++++++++++++++++++++++++
4 files changed, 140 insertions(+), 1 deletion(-)
ACK.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization:
qemu.org |
libvirt.org