Ticket #6822: operations.patch
File operations.patch, 1.9 KB (added by , 11 years ago) |
---|
-
operations.cpp
596 596 ::GetFullPathNameW(src.c_str(), static_cast<DWORD>(len), buf, p)); 597 597 } 598 598 599 fs::file_status process_status_failure(const path& p, error_code* ec)599 fs::file_status process_status_failure(const path& p, int errval, error_code* ec) 600 600 { 601 int errval(::GetLastError()); 601 // Some compilers can call ::SetLastError(0) just before process_status_failure 602 // is called. It is much safer to call ::GetLastError() in a function, 603 // that triggered a failure. 604 //int errval(::GetLastError()); 602 605 if (ec != 0) // always report errval, even though some 603 606 ec->assign(errval, system_category()); // errval values are not status_errors 604 607 … … 623 626 DWORD attr(::GetFileAttributesW(p.c_str())); 624 627 if (attr == 0xFFFFFFFF) 625 628 { 626 return process_status_failure(p, ec).type();629 return process_status_failure(p, ::GetLastError(), ec).type(); 627 630 } 628 631 629 632 if (ec != 0) ec->clear(); … … 1616 1619 DWORD attr(::GetFileAttributesW(p.c_str())); 1617 1620 if (attr == 0xFFFFFFFF) 1618 1621 { 1619 return process_status_failure(p, ec);1622 return process_status_failure(p, ::GetLastError(), ec); 1620 1623 } 1621 1624 1622 1625 // reparse point handling; … … 1635 1638 0)); // hTemplateFile 1636 1639 if (h.handle == INVALID_HANDLE_VALUE) 1637 1640 { 1638 return process_status_failure(p, ec);1641 return process_status_failure(p, ::GetLastError(), ec); 1639 1642 } 1640 1643 1641 1644 if (!is_reparse_point_a_symlink(p)) … … 1699 1702 DWORD attr(::GetFileAttributesW(p.c_str())); 1700 1703 if (attr == 0xFFFFFFFF) 1701 1704 { 1702 return process_status_failure(p, ec);1705 return process_status_failure(p, ::GetLastError(), ec); 1703 1706 } 1704 1707 1705 1708 if (ec != 0) ec->clear();