diff options
author | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2016-04-15 04:53:54 +0200 |
---|---|---|
committer | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2016-04-15 07:39:26 +0200 |
commit | c4b18a50de3ab04b189c9f0e2b56cb08a9f15542 (patch) | |
tree | 8344a28cc49a7689d31a3c760bda74e51de327a1 /test | |
parent | bcd49994e239e4d15bf4bc2fbed62eb2b914cc28 (diff) |
Adding support for msys.
Diffstat (limited to 'test')
-rw-r--r-- | test/core/util/port_windows.c | 9 | ||||
-rw-r--r-- | test/core/util/test_config.c | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/test/core/util/port_windows.c b/test/core/util/port_windows.c index 2b6d3dd223..154d607ec7 100644 --- a/test/core/util/port_windows.c +++ b/test/core/util/port_windows.c @@ -51,6 +51,11 @@ #include "src/core/lib/support/env.h" #include "test/core/util/port_server_client.h" +#if GPR_GETPID_IN_UNISTD_H +#include <sys/unistd.h> +static int _getpid() { return getpid(); } +#endif + #define NUM_RANDOM_PORTS_TO_PICK 100 static int *chosen_ports = NULL; @@ -114,7 +119,7 @@ static int is_port_available(int *port, int is_tcp) { /* Try binding to port */ addr.sin_family = AF_INET; addr.sin_addr.s_addr = INADDR_ANY; - addr.sin_port = htons(*port); + addr.sin_port = htons((u_short)*port); if (bind(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { gpr_log(GPR_DEBUG, "bind(port=%d) failed: %s", *port, strerror(errno)); closesocket(fd); @@ -127,7 +132,7 @@ static int is_port_available(int *port, int is_tcp) { closesocket(fd); return 0; } - GPR_ASSERT(alen <= sizeof(addr)); + GPR_ASSERT(alen <= (socklen_t)sizeof(addr)); actual_port = ntohs(addr.sin_port); GPR_ASSERT(actual_port > 0); if (*port == 0) { diff --git a/test/core/util/test_config.c b/test/core/util/test_config.c index 3155a4ece6..62468a5a61 100644 --- a/test/core/util/test_config.c +++ b/test/core/util/test_config.c @@ -50,7 +50,7 @@ static unsigned seed(void) { return (unsigned)getpid(); } #if GPR_GETPID_IN_PROCESS_H #include <process.h> -static unsigned seed(void) { return _getpid(); } +static unsigned seed(void) { return (unsigned)_getpid(); } #endif #if GPR_WINDOWS_CRASH_HANDLER |