From a2b97d056eb73aad6a2767a30215205ed69e422d Mon Sep 17 00:00:00 2001 From: John Haddon Date: Tue, 20 Apr 2021 17:08:47 +0100 Subject: [PATCH] OSLCompiler : Check for write errors (#1360) Fixes #1352 Signed-off-by: John Haddon --- src/liboslcomp/oslcomp.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/liboslcomp/oslcomp.cpp b/src/liboslcomp/oslcomp.cpp index 00ca0c22c..9e2c51dda 100644 --- a/src/liboslcomp/oslcomp.cpp +++ b/src/liboslcomp/oslcomp.cpp @@ -490,6 +490,13 @@ OSLCompilerImpl::compile(string_view filename, write_oso_file(OIIO::Strutil::join(options, " "), preprocess_result); OSL_DASSERT(m_osofile == nullptr); + + oso_output.close(); + if (!oso_output.good()) { + errorf(ustring(), 0, "Failed to write to \"%s\"", + m_output_filename); + return false; + } } oslcompiler = nullptr;