diff options
author | Asit Dhal <dhal.asitk@gmail.com> | 2020-06-13 22:39:33 (GMT) |
---|---|---|
committer | Asit Dhal <dhal.asitk@gmail.com> | 2020-06-17 03:22:34 (GMT) |
commit | 032506acc6db710d2b402f0d17ae678a0d6e8406 (patch) | |
tree | 3d5178c1187b86a3478e4c0ef6ad5576e79f8d68 /Source/cmMakefile.cxx | |
parent | 187f77f59cb2b66b9e5960993ead4deb81bc96ca (diff) | |
download | CMake-032506acc6db710d2b402f0d17ae678a0d6e8406.zip CMake-032506acc6db710d2b402f0d17ae678a0d6e8406.tar.gz CMake-032506acc6db710d2b402f0d17ae678a0d6e8406.tar.bz2 |
cmake: implement error handling in configure_file
Implement error handling in case it fails
Fixes: #20696
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 5c3063b..fa91059 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4027,6 +4027,8 @@ int cmMakefile::ConfigureFile(const std::string& infile, if (copyonly) { if (!cmSystemTools::CopyFileIfDifferent(sinfile, soutfile)) { + this->IssueMessage(MessageType::FATAL_ERROR, + cmSystemTools::GetLastSystemError()); return 0; } } else { @@ -4077,9 +4079,15 @@ int cmMakefile::ConfigureFile(const std::string& infile, fin.close(); fout.close(); if (!cmSystemTools::CopyFileIfDifferent(tempOutputFile, soutfile)) { + this->IssueMessage(MessageType::FATAL_ERROR, + cmSystemTools::GetLastSystemError()); res = 0; } else { - cmSystemTools::SetPermissions(soutfile, perm); + if (!cmSystemTools::SetPermissions(soutfile, perm)) { + this->IssueMessage(MessageType::FATAL_ERROR, + cmSystemTools::GetLastSystemError()); + res = 0; + } } cmSystemTools::RemoveFile(tempOutputFile); } |