瀏覽代碼

FIX: InitialPass() seg fault on std::copy and FinalPass() was not appending to the file

Jim Miller 24 年之前
父節點
當前提交
0905117480
共有 1 個文件被更改,包括 4 次插入3 次删除
  1. 4 3
      Source/cmAddTestCommand.cxx

+ 4 - 3
Source/cmAddTestCommand.cxx

@@ -54,8 +54,9 @@ bool cmAddTestCommand::InitialPass(std::vector<std::string>& args)
     return false;
     }
   
-  // store the aruments for the final pass
-  std::copy(args.begin(),args.end(),m_Args.begin());
+  // store the arguments for the final pass
+  m_Args.erase(m_Args.begin(), m_Args.end());
+  std::copy(args.begin(),args.end(),std::back_inserter(m_Args));
   return true;
 }
 
@@ -78,7 +79,7 @@ void cmAddTestCommand::FinalPass()
   fname += "CMakeTestfile.txt";
   
   // Open the output Testfile
-  std::ofstream fout(fname.c_str());
+  std::ofstream fout(fname.c_str(), std::ios_base::app);
   if (!fout)
     {
     cmSystemTools::Error("Error Writing ", fname.c_str());