tests/qtest: libqtest: Replace the call to close a socket with closesocket()
commit3665fadd468b3fb02371e57d1ab7de60c882038b
authorBin Meng <bin.meng@windriver.com>
Sun, 25 Sep 2022 11:30:23 +0000 (25 19:30 +0800)
committerThomas Huth <thuth@redhat.com>
Tue, 27 Sep 2022 18:51:21 +0000 (27 20:51 +0200)
tree4011081f5ac7446832eaf667697a7a654f1301f6
parente6f59e4c0b86a82cdaeacbd0ee94183b896523df
tests/qtest: libqtest: Replace the call to close a socket with closesocket()

close() is a *nix function. It works on any file descriptor, and
sockets in *nix are an example of a file descriptor.

closesocket() is a Windows-specific function, which works only
specifically with sockets. Sockets on Windows do not use *nix-style
file descriptors, and socket() returns a handle to a kernel object
instead, so it must be closed with closesocket().

In QEMU there is already a logic to handle such platform difference
in os-posix.h and os-win32.h, that:

  * closesocket maps to close on POSIX
  * closesocket maps to a wrapper that calls the real closesocket()
    on Windows

Replace the call to close a socket with closesocket() instead.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220925113032.1949844-46-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
tests/qtest/libqtest.c