Windows: add a wrapper for the shutdown() system call
Even though Windows's socket functions look like their POSIX counter parts, they do not operate on file descriptors, but on "socket objects". To bring the functions in line with POSIX, we have proxy functions that wrap and unwrap the socket objects in file descriptors using open_osfhandle and get_osfhandle. But shutdown() was not proxied, yet. Fix this. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
4fec83045b
commit
a7941795b1
@ -1219,6 +1219,13 @@ int mingw_setsockopt(int sockfd, int lvl, int optname, void *optval, int optlen)
|
||||
return setsockopt(s, lvl, optname, (const char*)optval, optlen);
|
||||
}
|
||||
|
||||
#undef shutdown
|
||||
int mingw_shutdown(int sockfd, int how)
|
||||
{
|
||||
SOCKET s = (SOCKET)_get_osfhandle(sockfd);
|
||||
return shutdown(s, how);
|
||||
}
|
||||
|
||||
#undef listen
|
||||
int mingw_listen(int sockfd, int backlog)
|
||||
{
|
||||
|
@ -219,6 +219,9 @@ int mingw_bind(int sockfd, struct sockaddr *sa, size_t sz);
|
||||
int mingw_setsockopt(int sockfd, int lvl, int optname, void *optval, int optlen);
|
||||
#define setsockopt mingw_setsockopt
|
||||
|
||||
int mingw_shutdown(int sockfd, int how);
|
||||
#define shutdown mingw_shutdown
|
||||
|
||||
int mingw_listen(int sockfd, int backlog);
|
||||
#define listen mingw_listen
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user