diff --git a/include/boost/process/v2/posix/detail/close_handles.ipp b/include/boost/process/v2/posix/detail/close_handles.ipp index a82035655..ce3e74629 100644 --- a/include/boost/process/v2/posix/detail/close_handles.ipp +++ b/include/boost/process/v2/posix/detail/close_handles.ipp @@ -101,7 +101,7 @@ void close_all(const std::vector & whitelist, error_code & ec) idx++) { const auto mine = whitelist[idx]; - const auto next = whitelist[idx]; + const auto next = whitelist[idx + 1]; if ((mine + 1) != next && (mine != next)) { ::close_range(mine + 1, next - 1, 0); @@ -132,7 +132,7 @@ void close_all(const std::vector & whitelist, error_code & ec) idx++) { const auto mine = whitelist[idx]; - const auto next = whitelist[idx]; + const auto next = whitelist[idx + 1]; if ((mine + 1) != next && (mine != next)) { ::close_range(mine + 1, next - 1, CLOSE_RANGE_UNSHARE);