Commit 622d6b55f91a72b97514f349a8adb3b2256f81b1
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 | 4 | * This program is free software: you can redistribute it and/or modify |
| 5 | 5 | * it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -22,12 +22,13 @@ |
| 22 | 22 | #include <string.h> |
| 23 | 23 | #include <stdlib.h> |
| 24 | 24 | #include <errno.h> |
| 25 | -#if !defined(_WIN32) | |
| 26 | -#define closesocket(s) close(s) | |
| 27 | -#endif | |
| 28 | 25 | |
| 29 | 26 | #include <modbus.h> |
| 30 | 27 | |
| 28 | +#if defined(_WIN32) | |
| 29 | +#define close closesocket | |
| 30 | +#endif | |
| 31 | + | |
| 31 | 32 | enum { |
| 32 | 33 | TCP, |
| 33 | 34 | RTU |
| ... | ... | @@ -91,7 +92,7 @@ int main(int argc, char *argv[]) |
| 91 | 92 | printf("Quit the loop: %s\n", modbus_strerror(errno)); |
| 92 | 93 | |
| 93 | 94 | modbus_mapping_free(mb_mapping); |
| 94 | - closesocket(socket); | |
| 95 | + close(socket); | |
| 95 | 96 | modbus_free(ctx); |
| 96 | 97 | |
| 97 | 98 | return 0; | ... | ... |