libtest: fix #40 (use nullptr instead of NULL)
[awesomized/libmemcached] / libtest / cmdline.cc
index fd9e510ded50c12ca26f30eae018a9d85e460a42..cbe8ff9a53ea70754cf7c8aa6f98c3a666c68576 100644 (file)
@@ -59,6 +59,7 @@ using namespace libtest;
 #include <unistd.h>
 
 #include <algorithm>
+#include <stdexcept>
 
 #ifndef __USE_GNU
 static char **environ= NULL;
@@ -78,7 +79,10 @@ namespace {
          iter != built_argv.end();
          ++iter)
     {
-      arg_buffer << *iter << " ";
+      if (*iter)
+      {
+        arg_buffer << *iter << " ";
+      }
     }
 
     return arg_buffer.str();
@@ -358,7 +362,7 @@ bool Application::slurp()
     int error;
     switch ((error= errno))
     {
-#ifdef TARGET_OS_LINUX
+#ifdef __linux
     case ERESTART:
 #endif
     case EINTR:
@@ -408,7 +412,7 @@ bool Application::slurp()
 
 Application::error_t Application::join()
 {
-  pid_t waited_pid= waitpid(_pid, &_status, 0);
+  pid_t waited_pid= waitpid(_pid, &_status, WUNTRACED);
   slurp();
   if (waited_pid == _pid and WIFEXITED(_status) == false)
   {
@@ -783,7 +787,7 @@ void Application::create_argv(const char *args[])
       vchar::append(built_argv, *ptr);
     }
   }
-  built_argv.push_back(NULL);
+  built_argv.push_back(nullptr);
 }
 
 std::string Application::print()