fd_util: add function close_socket()

Wrap close(), use closesocket() on WIN32/WinSock.
This commit is contained in:
Max Kellermann
2011-09-19 21:04:19 +02:00
parent 77a56c7c5a
commit c476819cb1
7 changed files with 26 additions and 8 deletions

View File

@@ -122,7 +122,7 @@ socket_bind_listen(int domain, int type, int protocol,
if (ret < 0) {
g_set_error(error, listen_quark(), errno,
"setsockopt() failed: %s", g_strerror(errno));
close(fd);
close_socket(fd);
return -1;
}
@@ -130,7 +130,7 @@ socket_bind_listen(int domain, int type, int protocol,
if (ret < 0) {
g_set_error(error, listen_quark(), errno,
"%s", g_strerror(errno));
close(fd);
close_socket(fd);
return -1;
}
@@ -138,7 +138,7 @@ socket_bind_listen(int domain, int type, int protocol,
if (ret < 0) {
g_set_error(error, listen_quark(), errno,
"listen() failed: %s", g_strerror(errno));
close(fd);
close_socket(fd);
return -1;
}