| 1447 | } |
| 1448 | |
| 1449 | BOOST_FILESYSTEM_DECL |
| 1450 | void recursive_directory_iterator_increment(recursive_directory_iterator& it, system::error_code* ec) |
| 1451 | { |
| 1452 | enum push_directory_result : unsigned int |
| 1453 | { |
| 1454 | directory_not_pushed = 0u, |
| 1455 | directory_pushed = 1u, |
| 1456 | keep_depth = 1u << 1u |
| 1457 | }; |
| 1458 | |
| 1459 | struct local |
| 1460 | { |
| 1461 | //! Attempts to descend into a directory |
| 1462 | static push_directory_result push_directory(detail::recur_dir_itr_imp* imp, system::error_code& ec) |
| 1463 | { |
| 1464 | push_directory_result result = directory_not_pushed; |
| 1465 | try |
| 1466 | { |
| 1467 | // Discover if the iterator is for a directory that needs to be recursed into, |
| 1468 | // taking symlinks and options into account. |
| 1469 | |
| 1470 | if ((imp->m_options & directory_options::_detail_no_push) != directory_options::none) |
| 1471 | { |
| 1472 | imp->m_options &= ~directory_options::_detail_no_push; |
| 1473 | return result; |
| 1474 | } |
| 1475 | |
| 1476 | file_type symlink_ft = status_error; |
| 1477 | |
| 1478 | #if defined(BOOST_FILESYSTEM_POSIX_API) && defined(BOOST_FILESYSTEM_HAS_FDOPENDIR_NOFOLLOW) && defined(BOOST_FILESYSTEM_HAS_POSIX_AT_APIS) |
| 1479 | int parentdir_fd = -1; |
| 1480 | path dir_it_filename; |
| 1481 | #elif defined(BOOST_FILESYSTEM_WINDOWS_API) |
| 1482 | unique_handle direntry_handle; |
| 1483 | #endif |
| 1484 | |
| 1485 | // If we are not recursing into symlinks, we are going to have to know if the |
| 1486 | // stack top is a symlink, so get symlink_status and verify no error occurred. |
| 1487 | if ((imp->m_options & directory_options::follow_directory_symlink) == directory_options::none || |
| 1488 | (imp->m_options & directory_options::skip_dangling_symlinks) != directory_options::none) |
| 1489 | { |
| 1490 | directory_iterator const& dir_it = imp->m_stack.back(); |
| 1491 | if (!filesystem::type_present(dir_it->m_symlink_status)) |
| 1492 | { |
| 1493 | #if defined(BOOST_FILESYSTEM_POSIX_API) |
| 1494 | |
| 1495 | #if defined(BOOST_FILESYSTEM_HAS_FDOPENDIR_NOFOLLOW) && defined(BOOST_FILESYSTEM_HAS_POSIX_AT_APIS) |
| 1496 | parentdir_fd = dir_itr_fd(*dir_it.m_imp, ec); |
| 1497 | if (BOOST_UNLIKELY(!!ec)) |
| 1498 | return result; |
| 1499 | |
| 1500 | dir_it_filename = detail::path_algorithms::filename_v4(dir_it->path()); |
| 1501 | |
| 1502 | dir_it->m_symlink_status = detail::symlink_status_impl(dir_it_filename, &ec, parentdir_fd); |
| 1503 | #else // defined(BOOST_FILESYSTEM_HAS_FDOPENDIR_NOFOLLOW) && defined(BOOST_FILESYSTEM_HAS_POSIX_AT_APIS) |
| 1504 | dir_it->m_symlink_status = detail::symlink_status_impl(dir_it->path(), &ec); |
| 1505 | #endif // defined(BOOST_FILESYSTEM_HAS_FDOPENDIR_NOFOLLOW) && defined(BOOST_FILESYSTEM_HAS_POSIX_AT_APIS) |
| 1506 | if (BOOST_UNLIKELY(!!ec)) |
no test coverage detected