[Rpm-maint] [rpm-software-management/rpm] Use close_range() to set close-on-exec on all fds (PR #4149)

Panu Matilainen notifications at github.com
Mon Mar 16 07:16:21 UTC 2026


@pmatilai commented on this pull request.



> @@ -1803,6 +1803,11 @@ void rpmSetCloseOnExec(void)
     const int min_fd = STDERR_FILENO; /* don't touch stdin/out/err */
     int fd;
 
+#ifdef HAVE_CLOSE_RANGE
+    if (close_range(min_fd + 1, ~0U, CLOSE_RANGE_CLOEXEC) == 0)
+        return;

This will also fall back to the old behavior if there was an error. It'd be good to document the intended behavior in that case.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/4149#pullrequestreview-3951861849
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/pull/4149/review/3951861849 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20260316/9111f4aa/attachment.htm>


More information about the Rpm-maint mailing list