Codechange: Replace all FILE * with FileHandle RAII class. (#12718)
This removes the need to manually ensure all files are closed.
This commit is contained in:
@@ -190,15 +190,14 @@ bool CrashLog::WriteCrashLog()
|
||||
{
|
||||
this->crashlog_filename = this->CreateFileName(".json.log");
|
||||
|
||||
FILE *file = FioFOpenFile(this->crashlog_filename, "w", NO_DIRECTORY);
|
||||
if (file == nullptr) return false;
|
||||
auto file = FioFOpenFile(this->crashlog_filename, "w", NO_DIRECTORY);
|
||||
if (!file.has_value()) return false;
|
||||
|
||||
std::string survey_json = this->survey.dump(4);
|
||||
|
||||
size_t len = survey_json.size();
|
||||
size_t written = fwrite(survey_json.data(), 1, len, file);
|
||||
size_t written = fwrite(survey_json.data(), 1, len, *file);
|
||||
|
||||
FioFCloseFile(file);
|
||||
return len == written;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user