From 7a17af0f5cad50f26ebeafd4baa0aae61c81992f Mon Sep 17 00:00:00 2001 From: Christian Eggers Date: Wed, 27 Mar 2024 13:17:23 +0100 Subject: [PATCH] v2: fix closing of file descriptors Fix off-by-one error. Currently, no handles are actually closed. --- include/boost/process/v2/posix/detail/close_handles.ipp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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);