From b8ea771b13989f353c2762abd40a65b6d33a1eb7 Mon Sep 17 00:00:00 2001 From: Paul Martin Date: Fri, 27 Feb 2015 10:45:26 -0500 Subject: [PATCH] KWSys SystemTools: Update CopyFileAlways stream library workarounds On some stream libraries failbit is not set when trying to read past EOF. Instead, always exit the copy loop when gcount() is zero. --- Source/kwsys/SystemTools.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 27082115d..b03e7b018 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -2330,6 +2330,10 @@ bool SystemTools::CopyFileAlways(const kwsys_stl::string& source, const kwsys_st { fout.write(buffer, fin.gcount()); } + else + { + break; + } } // Make sure the operating system has finished writing the file