[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
Wed Mar 18 07:00:06 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;
Looking closer at the man page, the only errors that one might have to care about are related to CLOSE_RANGE_UNSHARE, since we're calling it with hardcoded values.
So it seems to me the right thing is just do one or the other, depending on close_range() availability.
--
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/4149#discussion_r2951332710
You are receiving this because you are subscribed to this thread.
Message ID: <rpm-software-management/rpm/pull/4149/review/3965521609 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20260318/04f9fbde/attachment.htm>
More information about the Rpm-maint
mailing list