From d2aa1afd5b27e9f59d2519483f9129e10878c55e Mon Sep 17 00:00:00 2001 From: Paul Martin <paul.martin@codethink.co.uk> Date: Fri, 27 Feb 2015 10:45:26 -0500 Subject: [PATCH] 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. Change-Id: Ied2a6a366ade185426c34ef58795e66472dc71dc --- SystemTools.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SystemTools.cxx b/SystemTools.cxx index bf6f458..8a481d6 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -2375,6 +2375,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 -- GitLab