X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4658c44ec233e09db6f108f1ce01f06708907dd7..4a45223c970eabf6ba66347129627775935c90b3:/src/common/filefn.cpp diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index da2ce56b6f..4cfc2036a1 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -1003,7 +1003,7 @@ wxCopyFile (const wxString& file1, const wxString& file2, bool overwrite) // instead of our code if available // // NB: 3rd parameter is bFailIfExists i.e. the inverse of overwrite - return ::CopyFile(file1, file2, !overwrite); + return ::CopyFile(file1, file2, !overwrite) != 0; #else // !Win32 wxStructStat fbuf; @@ -1065,8 +1065,15 @@ wxCopyFile (const wxString& file1, const wxString& file2, bool overwrite) return FALSE; } + // we can expect fileIn to be closed successfully, but we should ensure + // that fileOut was closed as some write errors (disk full) might not be + // detected before doing this + if ( !fileIn.Close() || !fileOut.Close() ) + return FALSE; + #if !defined(__VISAGECPP__) && !defined(__WXMAC__) || defined(__UNIX__) - // no chmod in VA. SHould be some permission API for HPFS386 partitions however + // no chmod in VA. Should be some permission API for HPFS386 partitions + // however if ( chmod(OS_FILENAME(file2), fbuf.st_mode) != 0 ) { wxLogSysError(_("Impossible to set permissions for the file '%s'"),