Merge of cppccheck fixes.
[m6w6/libmemcached] / libtest / server_container.cc
index 2bea1ad96bac82040aed43edaf3380e5cf7dea82..0448e20900e2b847831a6f5c802a073e68eb9135 100644 (file)
@@ -75,7 +75,7 @@ void server_startup_st::push_server(Server *arg)
   }
   else
   {
-    char port_str[NI_MAXSERV];
+    char port_str[NI_MAXSERV]= { 0 };
     snprintf(port_str, sizeof(port_str), "%u", int(arg->port()));
 
     server_config_string+= "--server=";
@@ -99,7 +99,6 @@ Server* server_startup_st::pop_server()
 // host_to_shutdown => host number to shutdown in array
 bool server_startup_st::shutdown(uint32_t host_to_shutdown)
 {
-  Error << servers.size() << " > " << host_to_shutdown;
   if (servers.size() > host_to_shutdown)
   {
     Server* tmp= servers[host_to_shutdown];
@@ -143,7 +142,7 @@ bool server_startup_st::shutdown()
   bool success= true;
   for (std::vector<Server *>::iterator iter= servers.begin(); iter != servers.end(); ++iter)
   {
-    if ((*iter) and (*iter)->has_pid() and (*iter)->kill() == false)
+    if ((*iter)->has_pid() and (*iter)->kill() == false)
     {
       Error << "Unable to kill:" <<  *(*iter);
       success= false;
@@ -207,6 +206,16 @@ bool server_startup_st::start_server(const std::string& server_type, in_port_t t
         }
       }
     }
+    else if (server_type.compare("hostile-gearmand") == 0)
+    {
+      if (GEARMAND_BINARY)
+      {
+        if (HAVE_LIBGEARMAN)
+        {
+          server= build_gearmand("localhost", try_port, "gearmand/hostile_gearmand");
+        }
+      }
+    }
     else if (server_type.compare("drizzled") == 0)
     {
       if (DRIZZLED_BINARY)
@@ -278,17 +287,16 @@ bool server_startup_st::start_server(const std::string& server_type, in_port_t t
 
     server->build(argc, argv);
 
+#if 0
     if (false)
     {
       Out << "Pausing for startup, hit return when ready.";
       std::string gdb_command= server->base_command();
-      std::string options;
-#if 0
-      Out << "run " << server->args(options);
-#endif
       getchar();
     }
-    else if (server->start() == false)
+    else
+#endif
+      if (server->start() == false)
     {
       delete server;
       return false;
@@ -388,17 +396,18 @@ bool server_startup_st::start_socket_server(const std::string& server_type, cons
 
     server->build(argc, argv);
 
+#if 0
     if (false)
     {
       Out << "Pausing for startup, hit return when ready.";
       std::string gdb_command= server->base_command();
       std::string options;
-#if 0
       Out << "run " << server->args(options);
-#endif
       getchar();
     }
-    else if (server->start() == false)
+    else
+#endif
+      if (server->start() == false)
     {
       Error << "Failed to start " << *server;
       delete server;