From abb74e976384e2023381f41cc96c80746e664f42 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 10 Apr 2001 14:31:44 +0000 Subject: [PATCH] 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 --- src/common/filefn.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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'"), -- 2.47.2