diff --git a/include/boost/dll/detail/posix/path_from_handle.hpp b/include/boost/dll/detail/posix/path_from_handle.hpp index f4be75f6..9e0840c5 100644 --- a/include/boost/dll/detail/posix/path_from_handle.hpp +++ b/include/boost/dll/detail/posix/path_from_handle.hpp @@ -30,7 +30,7 @@ namespace boost { namespace dll { namespace detail { ); } - inline boost::dll::fs::path path_from_handle(void* handle, boost::dll::fs::error_code &ec) { + inline boost::dll::fs::path path_from_handle(void* handle, std::error_code &ec) { handle = strip_handle(handle); // Iterate through all images currently in memory @@ -53,8 +53,8 @@ namespace boost { namespace dll { namespace detail { } boost::dll::detail::reset_dlerror(); - ec = boost::dll::fs::make_error_code( - boost::dll::fs::errc::bad_file_descriptor + ec = std::make_error_code( + std::errc::bad_file_descriptor ); return boost::dll::fs::path(); @@ -78,7 +78,7 @@ namespace boost { namespace dll { namespace detail { // ... // Ignoring remaning parts of the structure }; - inline boost::dll::fs::path path_from_handle(const void* handle, boost::dll::fs::error_code &ec) { + inline boost::dll::fs::path path_from_handle(const void* handle, std::error_code &ec) { static const std::size_t work_around_b_24465209__offset = 128; const struct soinfo* si = reinterpret_cast( static_cast(handle) + work_around_b_24465209__offset @@ -119,7 +119,7 @@ namespace boost { namespace dll { namespace detail { }; #endif // #if BOOST_OS_QNX - inline boost::dll::fs::path path_from_handle(void* handle, boost::dll::fs::error_code &ec) { + inline boost::dll::fs::path path_from_handle(void* handle, std::error_code &ec) { // RTLD_DI_LINKMAP (RTLD_DI_ORIGIN returns only folder and is not suitable for this case) // Obtain the Link_map for the handle that is specified. // The p argument points to a Link_map pointer (Link_map @@ -144,8 +144,8 @@ namespace boost { namespace dll { namespace detail { #endif if (!link_map) { boost::dll::detail::reset_dlerror(); - ec = boost::dll::fs::make_error_code( - boost::dll::fs::errc::bad_file_descriptor + ec = std::make_error_code( + std::errc::bad_file_descriptor ); return boost::dll::fs::path(); diff --git a/include/boost/dll/detail/posix/program_location_impl.hpp b/include/boost/dll/detail/posix/program_location_impl.hpp index e4c7f7da..58544fa0 100644 --- a/include/boost/dll/detail/posix/program_location_impl.hpp +++ b/include/boost/dll/detail/posix/program_location_impl.hpp @@ -21,7 +21,7 @@ #include namespace boost { namespace dll { namespace detail { - inline boost::dll::fs::path program_location_impl(boost::dll::fs::error_code &ec) { + inline boost::dll::fs::path program_location_impl(std::error_code &ec) { ec.clear(); char path[1024]; @@ -31,8 +31,8 @@ namespace boost { namespace dll { namespace detail { char *p = new char[size]; if (_NSGetExecutablePath(p, &size) != 0) { - ec = boost::dll::fs::make_error_code( - boost::dll::fs::errc::bad_file_descriptor + ec = std::make_error_code( + std::errc::bad_file_descriptor ); } @@ -46,7 +46,7 @@ namespace boost { namespace dll { namespace detail { #include namespace boost { namespace dll { namespace detail { - inline boost::dll::fs::path program_location_impl(boost::dll::fs::error_code& ec) { + inline boost::dll::fs::path program_location_impl(std::error_code& ec) { ec.clear(); return boost::dll::fs::path(getexecname()); @@ -60,7 +60,7 @@ namespace boost { namespace dll { namespace detail { #include namespace boost { namespace dll { namespace detail { - inline boost::dll::fs::path program_location_impl(boost::dll::fs::error_code& ec) { + inline boost::dll::fs::path program_location_impl(std::error_code& ec) { ec.clear(); int mib[4]; @@ -81,7 +81,7 @@ namespace boost { namespace dll { namespace detail { #elif BOOST_OS_BSD_NET namespace boost { namespace dll { namespace detail { - inline boost::dll::fs::path program_location_impl(boost::dll::fs::error_code &ec) { + inline boost::dll::fs::path program_location_impl(std::error_code &ec) { return boost::dll::fs::read_symlink("/proc/curproc/exe", ec); } }}} // namespace boost::dll::detail @@ -90,7 +90,7 @@ namespace boost { namespace dll { namespace detail { namespace boost { namespace dll { namespace detail { - inline boost::dll::fs::path program_location_impl(boost::dll::fs::error_code &ec) { + inline boost::dll::fs::path program_location_impl(std::error_code &ec) { return boost::dll::fs::read_symlink("/proc/curproc/file", ec); } }}} // namespace boost::dll::detail @@ -100,7 +100,7 @@ namespace boost { namespace dll { namespace detail { #include #include // for std::getline namespace boost { namespace dll { namespace detail { - inline boost::dll::fs::path program_location_impl(boost::dll::fs::error_code &ec) { + inline boost::dll::fs::path program_location_impl(std::error_code &ec) { ec.clear(); std::string s; @@ -108,8 +108,8 @@ namespace boost { namespace dll { namespace detail { std::getline(ifs, s); if (ifs.fail() || s.empty()) { - ec = boost::dll::fs::make_error_code( - boost::dll::fs::errc::bad_file_descriptor + ec = std::make_error_code( + std::errc::bad_file_descriptor ); } @@ -120,12 +120,15 @@ namespace boost { namespace dll { namespace detail { #else // BOOST_OS_LINUX || BOOST_OS_UNIX || BOOST_OS_HPUX || BOOST_OS_ANDROID namespace boost { namespace dll { namespace detail { - inline boost::dll::fs::path program_location_impl(boost::dll::fs::error_code &ec) { + inline boost::dll::fs::path program_location_impl(std::error_code &ec) { // We can not use // boost::dll::detail::path_from_handle(dlopen(NULL, RTLD_LAZY | RTLD_LOCAL), ignore); // because such code returns empty path. - return boost::dll::fs::read_symlink("/proc/self/exe", ec); // Linux specific + boost::dll::fs::error_code fs_errc; + auto result = boost::dll::fs::read_symlink("/proc/self/exe", fs_errc); // Linux specific + ec = fs_errc; + return result; } }}} // namespace boost::dll::detail