aboutsummaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2020-06-03 15:08:16 +0100
committerRon Yorston <rmy@pobox.com>2020-06-03 15:50:04 +0100
commit214caad089b620f2b210c0948b1526d64932a256 (patch)
tree8811139935cfa12bfbfafd9b40c0e22c197bd07b /win32
parent27c718aa1a4674587925adb543362cb8e60814c4 (diff)
downloadbusybox-w32-214caad089b620f2b210c0948b1526d64932a256.tar.gz
busybox-w32-214caad089b620f2b210c0948b1526d64932a256.tar.bz2
busybox-w32-214caad089b620f2b210c0948b1526d64932a256.zip
win32: fix networking problems
The subprocess that handles incoming connections for httpd didn't work. It has an accepted connection on stdin and calls getpeername() to obtain its details, but getpeername() didn't initialise networking. ssl_client only seems to deal with file descriptors. Expose init_winsock() again and call it from ssl_client.
Diffstat (limited to 'win32')
-rw-r--r--win32/net.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/win32/net.c b/win32/net.c
index 880b807b7..33dc837fa 100644
--- a/win32/net.c
+++ b/win32/net.c
@@ -10,7 +10,7 @@ int inet_aton(const char *cp, struct in_addr *inp)
10 return 1; 10 return 1;
11} 11}
12 12
13static void init_winsock(void) 13void init_winsock(void)
14{ 14{
15 WSADATA wsa; 15 WSADATA wsa;
16 static int initialized = 0; 16 static int initialized = 0;
@@ -134,8 +134,10 @@ int mingw_accept(int sockfd1, struct sockaddr *sa, socklen_t *sz)
134#undef getpeername 134#undef getpeername
135int mingw_getpeername(int fd, struct sockaddr *sa, socklen_t *sz) 135int mingw_getpeername(int fd, struct sockaddr *sa, socklen_t *sz)
136{ 136{
137 SOCKET sock = (SOCKET)_get_osfhandle(fd); 137 SOCKET sock;
138 138
139 init_winsock();
140 sock = (SOCKET)_get_osfhandle(fd);
139 if (sock == INVALID_SOCKET) { 141 if (sock == INVALID_SOCKET) {
140 errno = EBADF; 142 errno = EBADF;
141 return -1; 143 return -1;