X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Fport.cc;h=d8e8c12d566beca74fc96836a9f0635b67342b5a;hb=59acef2d2b59a3f1a55337a933b97d901d46133a;hp=3d48a09c1ff7a0e65a8f20c4c272b570f75ba5e6;hpb=ad5cb8f903869065c72bb18bf98af6909189a5a9;p=awesomized%2Flibmemcached diff --git a/libtest/port.cc b/libtest/port.cc index 3d48a09c..d8e8c12d 100644 --- a/libtest/port.cc +++ b/libtest/port.cc @@ -34,7 +34,7 @@ * */ -#include "mem_config.h" +#include "libtest/yatlcon.h" #include #include @@ -142,10 +142,10 @@ in_port_t get_free_port() { ret_port= default_port; int sd; - if ((sd= socket(AF_INET, SOCK_STREAM, 0)) != -1) + if ((sd= socket(AF_INET, SOCK_STREAM, 0)) != SOCKET_ERROR) { int optval= 1; - if (setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)) != -1) + if (setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)) != SOCKET_ERROR) { struct sockaddr_in sin; sin.sin_port= 0; @@ -156,7 +156,7 @@ in_port_t get_free_port() int bind_ret; do { - if ((bind_ret= bind(sd, (struct sockaddr *)&sin, sizeof(struct sockaddr_in) )) != -1) + if ((bind_ret= bind(sd, (struct sockaddr *)&sin, sizeof(struct sockaddr_in) )) != SOCKET_ERROR) { socklen_t addrlen= sizeof(sin); @@ -204,22 +204,22 @@ in_port_t get_free_port() // We handle the case where if we max out retries, we still abort. if (retries == 0) { - fatal_message("No port could be found, exhausted retry"); + FATAL("No port could be found, exhausted retry"); } if (ret_port == 0) { - fatal_message("No port could be found"); + FATAL("No port could be found"); } if (ret_port == default_port) { - fatal_message("No port could be found"); + FATAL("No port could be found"); } if (ret_port <= 1024) { - fatal_message("No port could be found, though some where available below or at 1024"); + FATAL("No port could be found, though some where available below or at 1024"); } all_socket_fd.last_port= ret_port;