#define PATH_MAX MAX_PATH
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
+#define close CloseHandle
#define __const const
typedef int mode_t;
if(connect(sock, &sa->sa, SALEN(sa->sa))) {
logger(DEBUG_TRAFFIC, LOG_ERR, "Connecting MTU assessment socket for %s (%s) failed: %s", n->name, n->hostname, sockstrerror(sockerrno));
- close(sock);
+ closesocket(sock);
return MTU;
}
if(getsockopt(sock, IPPROTO_IP, IP_MTU, (void *)&ip_mtu, &ip_mtu_len)) {
logger(DEBUG_TRAFFIC, LOG_ERR, "getsockopt(IP_MTU) on %s (%s) failed: %s", n->name, n->hostname, sockstrerror(sockerrno));
- close(sock);
+ closesocket(sock);
return MTU;
}
- close(sock);
+ closesocket(sock);
if(ip_mtu < MINMTU) {
logger(DEBUG_TRAFFIC, LOG_ERR, "getsockopt(IP_MTU) on %s (%s) returned absurdly small value: %d", n->name, n->hostname, ip_mtu);
int udp_fd = setup_vpn_in_socket((sockaddr_t *) aip->ai_addr);
if(udp_fd < 0) {
- close(tcp_fd);
+ closesocket(tcp_fd);
continue;
}
for(int i = 0; i < listen_sockets; i++) {
io_del(&listen_socket[i].tcp);
io_del(&listen_socket[i].udp);
- close(listen_socket[i].tcp.fd);
- close(listen_socket[i].udp.fd);
+ closesocket(listen_socket[i].tcp.fd);
+ closesocket(listen_socket[i].udp.fd);
}
exit_requests();
}
}
- close(sockfd);
+ closesocket(sockfd);
}
}
}
}
- close(sockfd);
+ closesocket(sockfd);
}
}
// wait for tincd to close the connection...
}
- close(fd);
+ closesocket(fd);
pid = 0;
fd = -1;
if(select(fd + 1, &r, NULL, NULL, &tv)) {
fprintf(stderr, "Previous connection to tincd lost, reconnecting.\n");
- close(fd);
+ closesocket(fd);
fd = -1;
} else {
return true;
fprintf(stderr, "Cannot connect to UNIX socket %s: %s\n", unixsocketname, sockstrerror(sockerrno));
}
- close(fd);
+ closesocket(fd);
fd = -1;
return false;
}
fprintf(stderr, "Cannot connect to %s port %s: %s\n", host, port, sockstrerror(sockerrno));
}
- close(fd);
+ closesocket(fd);
fd = -1;
return false;
}
fprintf(stderr, "Cannot read greeting from control socket: %s\n", sockstrerror(sockerrno));
}
- close(fd);
+ closesocket(fd);
fd = -1;
return false;
}
fprintf(stderr, "Could not fully establish control socket connection\n");
}
- close(fd);
+ closesocket(fd);
fd = -1;
return false;
}
signal(SIGINT, SIG_DFL);
#endif
- close(fd);
+ closesocket(fd);
fd = -1;
return 0;
}
}
if(fd >= 0) {
- close(fd);
+ closesocket(fd);
fd = -1;
}