diff --git a/include/boost/process/detail/posix/environment.hpp b/include/boost/process/detail/posix/environment.hpp index c883f0c2..5a3ce611 100644 --- a/include/boost/process/detail/posix/environment.hpp +++ b/include/boost/process/detail/posix/environment.hpp @@ -210,7 +210,7 @@ public: Char ** _env_impl = &*_env_arr.data(); - native_handle_type native_handle() const {return &_data.front();} + native_handle_type native_handle() const {return _env_impl;} }; diff --git a/include/boost/process/environment.hpp b/include/boost/process/environment.hpp index 3b94f240..61d30156 100644 --- a/include/boost/process/environment.hpp +++ b/include/boost/process/environment.hpp @@ -263,7 +263,7 @@ public: auto st1 = key + ::boost::process::detail::equal_sign(); while (*p != nullptr) { - const std::size_t len = std::char_traits::length(*p); + const std::ptrdiff_t len = std::char_traits::length(*p); if ((std::distance(st1.begin(), st1.end()) < len) && std::equal(st1.begin(), st1.end(), *p)) break; diff --git a/test/environment.cpp b/test/environment.cpp index 4386844a..34b0aace 100644 --- a/test/environment.cpp +++ b/test/environment.cpp @@ -30,6 +30,7 @@ BOOST_AUTO_TEST_CASE(empty, *boost::unit_test::timeout(5)) BOOST_CHECK(ev.empty()); BOOST_CHECK_EQUAL(ev.size(), 0u); BOOST_CHECK_EQUAL(ev.end() - ev.begin(), 0); + auto nh = ev.native_handle(); ev["Thingy"] = "My value"; BOOST_CHECK(!ev.empty());