aboutsummaryrefslogtreecommitdiffhomepage
path: root/backends/libmmbackend.c
diff options
context:
space:
mode:
Diffstat (limited to 'backends/libmmbackend.c')
-rw-r--r--backends/libmmbackend.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/backends/libmmbackend.c b/backends/libmmbackend.c
index bad048c..18611e1 100644
--- a/backends/libmmbackend.c
+++ b/backends/libmmbackend.c
@@ -3,6 +3,10 @@
#define LOGPF(format, ...) fprintf(stderr, "libmmbe\t" format "\n", __VA_ARGS__)
#define LOG(message) fprintf(stderr, "libmmbe\t%s\n", (message))
+#ifndef _WIN32
+ #define closesocket close
+#endif
+
int mmbackend_strdup(char** dest, char* src){
if(*dest){
free(*dest);
@@ -186,14 +190,14 @@ int mmbackend_socket(char* host, char* port, int socktype, uint8_t listener, uin
if(listener){
status = bind(fd, addr_it->ai_addr, addr_it->ai_addrlen);
if(status < 0){
- close(fd);
+ closesocket(fd);
continue;
}
}
else{
status = connect(fd, addr_it->ai_addr, addr_it->ai_addrlen);
if(status < 0){
- close(fd);
+ closesocket(fd);
continue;
}
}