[Rpm-maint] [rpm-software-management/rpm] luaext/Pexec: optimize setting CLOEXEC (#444)
Kirill Kolyshkin
notifications at github.com
Thu May 17 21:26:03 UTC 2018
kolyshkin commented on this pull request.
> + fcntl(fd, F_SETFD, FD_CLOEXEC);
+}
+
+static void set_cloexec_all(void)
+{
+ const int min_fd = 3; // don't touch stdin/out/err
+ const int default_open_max = 1024;
+ int fd, open_max;
+
+ open_max = sysconf(_SC_OPEN_MAX);
+ if (open_max == -1) {
+ open_max = default_open_max;
+ goto fallback;
+ }
+
+ if (open_max <= default_open_max) {
I wanted to be conservative for the sole reason to minimize the change to current behavior. What you say makes sense though, let me update the patch.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/444#discussion_r189106419
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20180517/8fa7ede5/attachment.html>
More information about the Rpm-maint
mailing list