Index: operations.cpp =================================================================== --- operations.cpp (revision 86799) +++ operations.cpp (working copy) @@ -383,14 +383,21 @@ if (type == fs::directory_file) // but not a directory symlink { - for (fs::directory_iterator itr(p); - itr != end_dir_itr; ++itr) - { - fs::file_type tmp_type = query_file_type(itr->path(), ec); - if (ec != 0 && *ec) - return count; - count += remove_all_aux(itr->path(), tmp_type, ec); - } + try { + for (fs::directory_iterator itr(p); + itr != end_dir_itr; ++itr) { + + fs::file_type tmp_type = query_file_type(itr->path(), ec); + if (ec != 0 && *ec) + return count; + count += remove_all_aux(itr->path(), tmp_type, ec); + } + } + catch(...) { + int errval(BOOST_ERRNO); + ec->assign(errval, system_category()); + return count; + } } remove_file_or_directory(p, type, ec); return count;