libhashkit: fix #25
[awesomized/libmemcached] / libtest / port.cc
index b955ca4b96be0cbf067ba36c148b572ce38bf849..d8e8c12d566beca74fc96836a9f0635b67342b5a 100644 (file)
@@ -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;