| --- a/libs/filesystem/v2/src/v2_operations.cpp 2010-08-10 13:00:09.000000000 -0700 |
| +++ b/libs/filesystem/v2/src/v2_operations.cpp 2011-06-16 17:28:00.000000000 -0700 |
| @@ -1215,8 +1214,9 @@ |
| if ( ::stat( from_file_ph.c_str(), &from_stat ) != 0 ) |
| { return error_code( errno, system_category() ); } |
| |
| - int oflag = O_CREAT | O_WRONLY; |
| - if ( fail_if_exists ) oflag |= O_EXCL; |
| + int oflag = O_CREAT | O_WRONLY | O_TRUNC; |
| + if ( fail_if_exists ) |
| + oflag |= O_EXCL; |
| if ( (outfile = ::open( to_file_ph.c_str(), oflag, from_stat.st_mode )) < 0 ) |
| { |
| int open_errno = errno; |
| --- a/libs/filesystem/v3/src/operations.cpp 2010-10-16 06:09:25.000000000 -0700 |
| +++ b/libs/filesystem/v3/src/operations.cpp 2011-06-16 17:28:00.000000000 -0700 |
| @@ -426,8 +433,9 @@ |
| if (::stat(from_p.c_str(), &from_stat)!= 0) |
| { return false; } |
| |
| - int oflag = O_CREAT | O_WRONLY; |
| - if (fail_if_exists)oflag |= O_EXCL; |
| + int oflag = O_CREAT | O_WRONLY | O_TRUNC; |
| + if (fail_if_exists) |
| + oflag |= O_EXCL; |
| if ((outfile = ::open(to_p.c_str(), oflag, from_stat.st_mode))< 0) |
| { |
| int open_errno = errno; |