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>

Johannes Sixt committed May 18, 2011 at 22:24 UTC a7941795b1eb720f3bf3df2f4c68d58dd0fba7e1
2 files changed +10
compat/mingw.c
+7
@@ -1219,6 +1219,13 @@ int mingw_setsockopt(int sockfd, int lvl, int optname, void *optval, int optlen)
1219 return setsockopt(s, lvl, optname, (const char*)optval, optlen);
1220 }
1221
1222 +#undef shutdown
1223 +int mingw_shutdown(int sockfd, int how)
1224 +{
1225 + SOCKET s = (SOCKET)_get_osfhandle(sockfd);
1226 + return shutdown(s, how);
1227 +}
1228 +
1229 #undef listen
1230 int mingw_listen(int sockfd, int backlog)
1231 {
compat/mingw.h
+3
@@ -219,6 +219,9 @@ int mingw_bind(int sockfd, struct sockaddr *sa, size_t sz);
219 int mingw_setsockopt(int sockfd, int lvl, int optname, void *optval, int optlen);
220 #define setsockopt mingw_setsockopt
221
222 +int mingw_shutdown(int sockfd, int how);
223 +#define shutdown mingw_shutdown
224 +
225 int mingw_listen(int sockfd, int backlog);
226 #define listen mingw_listen
227