Commit 622d6b55f91a72b97514f349a8adb3b2256f81b1

Authored by Stéphane Raimbault
1 parent 4623862b

Avoid to define closesocket on POSIX systems in tests

Showing 1 changed file with 6 additions and 5 deletions
tests/bandwidth-server-one.c
1 /* 1 /*
2 - * Copyright © 2008-2010 Stéphane Raimbault <stephane.raimbault@gmail.com> 2 + * Copyright © 2008-2012 Stéphane Raimbault <stephane.raimbault@gmail.com>
3 * 3 *
4 * This program is free software: you can redistribute it and/or modify 4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
@@ -22,12 +22,13 @@ @@ -22,12 +22,13 @@
22 #include <string.h> 22 #include <string.h>
23 #include <stdlib.h> 23 #include <stdlib.h>
24 #include <errno.h> 24 #include <errno.h>
25 -#if !defined(_WIN32)  
26 -#define closesocket(s) close(s)  
27 -#endif  
28 25
29 #include <modbus.h> 26 #include <modbus.h>
30 27
  28 +#if defined(_WIN32)
  29 +#define close closesocket
  30 +#endif
  31 +
31 enum { 32 enum {
32 TCP, 33 TCP,
33 RTU 34 RTU
@@ -91,7 +92,7 @@ int main(int argc, char *argv[]) @@ -91,7 +92,7 @@ int main(int argc, char *argv[])
91 printf("Quit the loop: %s\n", modbus_strerror(errno)); 92 printf("Quit the loop: %s\n", modbus_strerror(errno));
92 93
93 modbus_mapping_free(mb_mapping); 94 modbus_mapping_free(mb_mapping);
94 - closesocket(socket); 95 + close(socket);
95 modbus_free(ctx); 96 modbus_free(ctx);
96 97
97 return 0; 98 return 0;