Explicitly close the output stream.

PiperOrigin-RevId: 503904221
Change-Id: Iee1899d80190a314c9c83f0a69e5fac76494cd92
This commit is contained in:
Sandboxed API Team 2023-01-23 00:06:19 -08:00 committed by Copybara-Service
parent 8c107936da
commit 93ef7eb380

View File

@ -272,6 +272,7 @@ bool CopyFile(const std::string& old_path, const std::string& new_path,
std::ofstream output(new_path,
std::ios_base::trunc | std::ios_base::binary);
output << input.rdbuf();
output.close();
if (!input || !output) {
return false;
}