diff options
author | Brad King <brad.king@kitware.com> | 2010-06-03 16:46:11 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2010-06-03 16:46:11 (GMT) |
commit | c15ed3294c68cc819d9471c4ea41dc3d2a95aadd (patch) | |
tree | db4af0b907df4d8905ae0d48ad2f19eac55032ad /Source/kwsys/SystemTools.cxx | |
parent | 3ac3dea6f0eb1ce68b321020ecdd336b3db8a0fe (diff) | |
download | CMake-c15ed3294c68cc819d9471c4ea41dc3d2a95aadd.zip CMake-c15ed3294c68cc819d9471c4ea41dc3d2a95aadd.tar.gz CMake-c15ed3294c68cc819d9471c4ea41dc3d2a95aadd.tar.bz2 |
KWSys: Avoid stat in CopyFileAlways (#10790)
On Windows 7 the file size reported by 'stat' on a new file sometimes
reports zero even though the real size is correct. This causes our
CopyFileAlways method to falsely detect copy failure. Work around the
problem by trusting the state of ofstream after writing the file.
Diffstat (limited to 'Source/kwsys/SystemTools.cxx')
-rw-r--r-- | Source/kwsys/SystemTools.cxx | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index afc7240..a2e194a 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -1924,22 +1924,10 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination, fin.close(); fout.close(); - // More checks. - struct stat statSource, statDestination; - statSource.st_size = 12345; - statDestination.st_size = 12345; - if(stat(source, &statSource) != 0) - { - return false; - } - else if(stat(destination, &statDestination) != 0) + if(!fout) { return false; } - else if(statSource.st_size != statDestination.st_size) - { - return false; - } if ( copyPermissions && perms ) { if ( !SystemTools::SetPermissions(destination, perm) ) |