aboutsummaryrefslogtreecommitdiff
path: root/win32/net.c
diff options
context:
space:
mode:
Diffstat (limited to 'win32/net.c')
-rw-r--r--win32/net.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/win32/net.c b/win32/net.c
index 2341119b0..01fa16a4e 100644
--- a/win32/net.c
+++ b/win32/net.c
@@ -99,3 +99,15 @@ int mingw_accept(int sockfd1, struct sockaddr *sa, socklen_t *sz)
99 } 99 }
100 return sockfd2; 100 return sockfd2;
101} 101}
102
103#undef getpeername
104int mingw_getpeername(int fd, struct sockaddr *sa, socklen_t *sz)
105{
106 SOCKET sock = (SOCKET)_get_osfhandle(fd);
107
108 if (sock == INVALID_SOCKET) {
109 errno = EBADF;
110 return -1;
111 }
112 return getpeername(sock, sa, sz);
113}