浏览代码

BUG: fix for 5071, report error if output file can not be opened

Bill Hoffman 17 年之前
父节点
当前提交
ada0f98e91
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      Source/cmOutputRequiredFilesCommand.cxx

+ 7 - 0
Source/cmOutputRequiredFilesCommand.cxx

@@ -199,6 +199,13 @@ bool cmOutputRequiredFilesCommand
     {
     // write them out
     FILE *fout = fopen(this->OutputFile.c_str(),"w");
+    if(!fout)
+      {
+      std::string err = "Can not open output file: ";
+      err += this->OutputFile;
+      this->SetError(err.c_str());
+      return false;
+      }
     std::set<cmDependInformation const*> visited;
     this->ListDependencies(info,fout, &visited);
     fclose(fout);