diff options
Diffstat (limited to 'io/channel-socket.c')
-rw-r--r-- | io/channel-socket.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/io/channel-socket.c b/io/channel-socket.c index b50e63a053..bc5f80e780 100644 --- a/io/channel-socket.c +++ b/io/channel-socket.c @@ -688,10 +688,13 @@ qio_channel_socket_close(QIOChannel *ioc, int rc = 0; if (sioc->fd != -1) { - SocketAddress *addr = socket_local_address(sioc->fd, errp); #ifdef WIN32 WSAEventSelect(sioc->fd, NULL, 0); #endif + if (qio_channel_has_feature(ioc, QIO_CHANNEL_FEATURE_LISTEN)) { + socket_listen_cleanup(sioc->fd, errp); + } + if (closesocket(sioc->fd) < 0) { sioc->fd = -1; error_setg_errno(errp, errno, @@ -699,20 +702,6 @@ qio_channel_socket_close(QIOChannel *ioc, return -1; } sioc->fd = -1; - - if (addr && addr->type == SOCKET_ADDRESS_TYPE_UNIX - && addr->u.q_unix.path) { - if (unlink(addr->u.q_unix.path) < 0 && errno != ENOENT) { - error_setg_errno(errp, errno, - "Failed to unlink socket %s", - addr->u.q_unix.path); - rc = -1; - } - } - - if (addr) { - qapi_free_SocketAddress(addr); - } } return rc; } |