mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
win32: replace closesocket() with close() wrapper
Use a close() wrapper instead, so that we don't need to worry about closesocket() vs close() anymore, let's hope. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Message-Id: <20230221124802.4103554-17-marcandre.lureau@redhat.com>
This commit is contained in:
parent
b7e5374637
commit
25657fc6c1
14 changed files with 89 additions and 89 deletions
|
@ -124,7 +124,7 @@ static int socket_accept(int sock)
|
|||
(void *)&timeout, sizeof(timeout))) {
|
||||
fprintf(stderr, "%s failed to set SO_RCVTIMEO: %s\n",
|
||||
__func__, strerror(errno));
|
||||
closesocket(sock);
|
||||
close(sock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ static int socket_accept(int sock)
|
|||
if (ret == -1) {
|
||||
fprintf(stderr, "%s failed: %s\n", __func__, strerror(errno));
|
||||
}
|
||||
closesocket(sock);
|
||||
close(sock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -564,8 +564,8 @@ void qtest_quit(QTestState *s)
|
|||
qtest_remove_abrt_handler(s);
|
||||
|
||||
qtest_kill_qemu(s);
|
||||
closesocket(s->fd);
|
||||
closesocket(s->qmp_fd);
|
||||
close(s->fd);
|
||||
close(s->qmp_fd);
|
||||
g_string_free(s->rx, true);
|
||||
|
||||
for (GList *it = s->pending_events; it != NULL; it = it->next) {
|
||||
|
|
|
@ -107,7 +107,7 @@ static void test_nrf51_uart(void)
|
|||
g_assert_true(recv(sock_fd, s, 10, 0) == 5);
|
||||
g_assert_true(memcmp(s, "world", 5) == 0);
|
||||
|
||||
closesocket(sock_fd);
|
||||
close(sock_fd);
|
||||
|
||||
qtest_quit(qts);
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ static int inet_get_free_port_multiple(int nb, int *port, bool ipv6)
|
|||
|
||||
nb = i;
|
||||
for (i = 0; i < nb; i++) {
|
||||
closesocket(sock[i]);
|
||||
close(sock[i]);
|
||||
}
|
||||
|
||||
return nb;
|
||||
|
@ -361,8 +361,8 @@ static void test_stream_fd(void)
|
|||
qtest_quit(qts1);
|
||||
qtest_quit(qts0);
|
||||
|
||||
closesocket(sock[0]);
|
||||
closesocket(sock[1]);
|
||||
close(sock[0]);
|
||||
close(sock[1]);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -487,8 +487,8 @@ static void test_dgram_fd(void)
|
|||
qtest_quit(qts1);
|
||||
qtest_quit(qts0);
|
||||
|
||||
closesocket(sv[0]);
|
||||
closesocket(sv[1]);
|
||||
close(sv[0]);
|
||||
close(sv[1]);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -117,13 +117,13 @@ static int socket_can_bind_connect(const char *hostname, int family)
|
|||
|
||||
cleanup:
|
||||
if (afd != -1) {
|
||||
closesocket(afd);
|
||||
close(afd);
|
||||
}
|
||||
if (cfd != -1) {
|
||||
closesocket(cfd);
|
||||
close(cfd);
|
||||
}
|
||||
if (lfd != -1) {
|
||||
closesocket(lfd);
|
||||
close(lfd);
|
||||
}
|
||||
if (res) {
|
||||
freeaddrinfo(res);
|
||||
|
@ -160,7 +160,7 @@ void socket_check_afunix_support(bool *has_afunix)
|
|||
int fd;
|
||||
|
||||
fd = socket(PF_UNIX, SOCK_STREAM, 0);
|
||||
closesocket(fd);
|
||||
close(fd);
|
||||
|
||||
#ifdef _WIN32
|
||||
*has_afunix = (fd != (int)INVALID_SOCKET);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue