diff options
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r-- | Source/cmFileCommand.cxx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 6c1a869..1e47687 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -232,6 +232,14 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args, } std::string message = cmJoin(cmMakeRange(i, args.end()), std::string()); file << message; + if (!file) { + std::string error = "write failed ("; + error += cmSystemTools::GetLastSystemError(); + error += "):\n "; + error += fileName; + this->SetError(error); + return false; + } file.close(); if (mode) { cmSystemTools::SetPermissions(fileName.c_str(), mode); |