Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73402 - in trunk/libs/filesystem: v2/src v3/src
From: bdawes_at_[hidden]
Date: 2011-07-27 14:39:31


Author: bemandawes
Date: 2011-07-27 14:39:29 EDT (Wed, 27 Jul 2011)
New Revision: 73402
URL: http://svn.boost.org/trac/boost/changeset/73402

Log:
Fix #7534 both v2 and v3 - copy_file failing to close file after stat error
Text files modified:
   trunk/libs/filesystem/v2/src/v2_operations.cpp | 5 ++++-
   trunk/libs/filesystem/v3/src/operations.cpp | 5 ++++-
   2 files changed, 8 insertions(+), 2 deletions(-)

Modified: trunk/libs/filesystem/v2/src/v2_operations.cpp
==============================================================================
--- trunk/libs/filesystem/v2/src/v2_operations.cpp (original)
+++ trunk/libs/filesystem/v2/src/v2_operations.cpp 2011-07-27 14:39:29 EDT (Wed, 27 Jul 2011)
@@ -1212,7 +1212,10 @@
 
         struct stat from_stat;
         if ( ::stat( from_file_ph.c_str(), &from_stat ) != 0 )
- { return error_code( errno, system_category() ); }
+ {
+ ::close(infile);
+ return error_code( errno, system_category() );
+ }
 
         int oflag = O_CREAT | O_WRONLY | O_TRUNC;
         if ( fail_if_exists )

Modified: trunk/libs/filesystem/v3/src/operations.cpp
==============================================================================
--- trunk/libs/filesystem/v3/src/operations.cpp (original)
+++ trunk/libs/filesystem/v3/src/operations.cpp 2011-07-27 14:39:29 EDT (Wed, 27 Jul 2011)
@@ -431,7 +431,10 @@
 
     struct stat from_stat;
     if (::stat(from_p.c_str(), &from_stat)!= 0)
- { return false; }
+ {
+ ::close(infile);
+ return false;
+ }
 
     int oflag = O_CREAT | O_WRONLY | O_TRUNC;
     if (fail_if_exists)


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk