diff --git a/include/boost/dll/detail/posix/path_from_handle.hpp b/include/boost/dll/detail/posix/path_from_handle.hpp index be621e3..0ad8816 100644 --- a/include/boost/dll/detail/posix/path_from_handle.hpp +++ b/include/boost/dll/detail/posix/path_from_handle.hpp @@ -143,13 +143,13 @@ namespace boost { namespace dll { namespace detail { #if BOOST_OS_CYGWIN // Cygwin doesn't have header - unsigned long long DEFAULT_BUFFER_SIZE = 4096; - std::vector buffer(DEFAULT_BUFFER_SIZE); + unsigned long long buffer_size = 4096; + std::vector buffer; do { - buffer.resize(DEFAULT_BUFFER_SIZE); + buffer.resize(buffer_size); GetModuleFileNameW(handle, buffer.data(), buffer.size()); - DEFAULT_BUFFER_SIZE *= 2; + buffer_size *= 2; } while (GetLastError() == 122 /* ERROR_INSUFFICIENT_BUFFER */); if (GetLastError() == 0) {