From 6ea6bf9e92b743d8e4be5daa6e2ee6f678c5c757 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Mon, 1 Apr 2013 08:37:21 +0000 Subject: [PATCH] revert mistake --- ChangeLog | 1 - src/storage.cpp | 20 ++++++-------------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 772ed3aad..38a7ac669 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,7 +20,6 @@ * fix uTP edge case where udp socket buffer fills up * fix nagle implementation in uTP - * fixed error handling of missing directories in download path * try unencrypted connections first, and fall back to encryption if it fails (performance improvement) * add missing functions to python binding (flush_cache(), remap_files() and orig_files()) * improve handling of filenames that are invalid on windows diff --git a/src/storage.cpp b/src/storage.cpp index 59d2ca030..0871dc5a3 100644 --- a/src/storage.cpp +++ b/src/storage.cpp @@ -514,8 +514,7 @@ namespace libtorrent // if old_name doesn't exist, that's not an error // here. Once we start writing to the file, it will // be written to the new filename - if (ec && ec != boost::system::errc::no_such_file_or_directory - && ec != boost::system::errc::not_a_directory) + if (ec && ec != boost::system::errc::no_such_file_or_directory) { set_error(old_name, ec); return true; @@ -541,8 +540,7 @@ namespace libtorrent error_code ec; remove(p, ec); - if (ec && ec != boost::system::errc::no_such_file_or_directory - && ec != boost::system::errc::not_a_directory) + if (ec && ec != boost::system::errc::no_such_file_or_directory) set_error(p, ec); } @@ -758,8 +756,7 @@ namespace libtorrent error_code ec; file_status s; stat_file(save_path, &s, ec); - if (ec == boost::system::errc::no_such_file_or_directory - || ec == boost::system::errc::not_a_directory) + if (ec == boost::system::errc::no_such_file_or_directory) create_directories(save_path, ec); else if (ec) return false; @@ -784,8 +781,7 @@ namespace libtorrent std::string new_path = combine_path(save_path, *i); rename(old_path, new_path, ec); - if (ec && ec != boost::system::errc::no_such_file_or_directory - && ec != boost::system::errc::not_a_directory) + if (ec && ec != boost::system::errc::no_such_file_or_directory) { error_code ec; recursive_copy(old_path, new_path, ec); @@ -1159,9 +1155,7 @@ ret: error_code ec; file_handle = open_file(file_iter, op.mode, ec); - if (((op.mode & file::rw_mask) == file::read_write) - && (ec == boost::system::errc::no_such_file_or_directory - || ec == boost::system::errc::not_a_directory)) + if (((op.mode & file::rw_mask) == file::read_write) && ec == boost::system::errc::no_such_file_or_directory) { // this means the directory the file is in doesn't exist. // so create it @@ -1292,9 +1286,7 @@ ret: TORRENT_ASSERT((aligned_size & size_align) == 0); size_type actual_file_size = file_handle->get_size(ec); - if (ec && ec != boost::system::errc::no_such_file_or_directory - && ec != boost::system::errc::not_a_directory) - return -1; + if (ec && ec != make_error_code(boost::system::errc::no_such_file_or_directory)) return -1; ec.clear(); // allocate a temporary, aligned, buffer