status() implementation
| 1795 | |
| 1796 | //! status() implementation |
| 1797 | fs::file_status status_impl(path const& p, error_code* ec) |
| 1798 | { |
| 1799 | // We should first test if the file is a symlink or a reparse point. Resolving some reparse |
| 1800 | // points by opening the file may fail, and status() should return file_status(reparse_file) in this case. |
| 1801 | // Which is what symlink_status() returns. |
| 1802 | fs::file_status st(detail::symlink_status_impl(p, ec)); |
| 1803 | if (st.type() == symlink_file) |
| 1804 | { |
| 1805 | // Resolve the symlink |
| 1806 | unique_handle h(create_file_handle( |
| 1807 | p.c_str(), |
| 1808 | FILE_READ_ATTRIBUTES | FILE_READ_EA, // see the comment in symlink_status_impl re. access mode |
| 1809 | FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, |
| 1810 | nullptr, // lpSecurityAttributes |
| 1811 | OPEN_EXISTING, |
| 1812 | FILE_FLAG_BACKUP_SEMANTICS)); |
| 1813 | |
| 1814 | if (!h) |
| 1815 | return process_status_failure(p, ec); |
| 1816 | |
| 1817 | st = detail::status_by_handle(h.get(), p, ec); |
| 1818 | } |
| 1819 | |
| 1820 | return st; |
| 1821 | } |
| 1822 | |
| 1823 | namespace { |
| 1824 |
no test coverage detected