fixed incorrect error when deleting files from a torrent where not all files have been created

This commit is contained in:
Arvid Norberg 2009-10-08 18:21:13 +00:00
parent cee42ff5a1
commit fdb3b355ad
2 changed files with 6 additions and 1 deletions

View File

@ -85,6 +85,8 @@ release 0.14.7
* fixed division by zero in get_peer_info() * fixed division by zero in get_peer_info()
* fixed bug where pieces may have been requested before the metadata * fixed bug where pieces may have been requested before the metadata
was received was received
* fixed incorrect error when deleting files from a torrent where
not all files have been created
release 0.14.6 release 0.14.6

View File

@ -752,7 +752,9 @@ namespace libtorrent
#if BOOST_VERSION >= 103500 #if BOOST_VERSION >= 103500
catch (boost::system::system_error& e) catch (boost::system::system_error& e)
{ {
set_error(p, e.code()); // no such file or directory is not an error
if (e.code() != make_error_code(boost::system::errc::no_such_file_or_directory))
set_error(p, e.code());
} }
#else #else
catch (boost::filesystem::filesystem_error& e) catch (boost::filesystem::filesystem_error& e)
@ -762,6 +764,7 @@ namespace libtorrent
#endif // BOOST_VERSION #endif // BOOST_VERSION
#endif // BOOST_NO_EXCEPTIONS #endif // BOOST_NO_EXCEPTIONS
#else #else
// no such file or directory is not an error
if (std::remove(convert_to_native(p).c_str()) != 0 && errno != ENOENT) if (std::remove(convert_to_native(p).c_str()) != 0 && errno != ENOENT)
{ {
set_error(p, error_code(errno, get_posix_category())); set_error(p, error_code(errno, get_posix_category()));