From: Vadim Zeitlin Date: Tue, 10 Apr 2001 14:31:44 +0000 (+0000) Subject: check that file was closed successfully in wxCopyFile (bug 414987 ) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/abb74e976384e2023381f41cc96c80746e664f42?hp=ff43029e01b63f71a001fd0b5501d11780f8cd7d check that file was closed successfully in wxCopyFile (bug 414987 ) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9703 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index da2ce56b6f..293e8e787c 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -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'"),