diff options
author | Dave Cobbley <david.j.cobbley@linux.intel.com> | 2018-08-14 20:05:37 +0300 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-08-23 04:26:31 +0300 |
commit | eb8dc40360f0cfef56fb6947cc817a547d6d9bc6 (patch) | |
tree | de291a73dc37168da6370e2cf16c347d1eba9df8 /poky/meta/recipes-devtools/rpm/files/0003-rpmSetCloseOnExec-use-getrlimit.patch | |
parent | 9c3cf826d853102535ead04cebc2d6023eff3032 (diff) | |
download | openbmc-eb8dc40360f0cfef56fb6947cc817a547d6d9bc6.tar.xz |
[Subtree] Removing import-layers directory
As part of the move to subtrees, need to bring all the import layers
content to the top level.
Change-Id: I4a163d10898cbc6e11c27f776f60e1a470049d8f
Signed-off-by: Dave Cobbley <david.j.cobbley@linux.intel.com>
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'poky/meta/recipes-devtools/rpm/files/0003-rpmSetCloseOnExec-use-getrlimit.patch')
-rw-r--r-- | poky/meta/recipes-devtools/rpm/files/0003-rpmSetCloseOnExec-use-getrlimit.patch | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/poky/meta/recipes-devtools/rpm/files/0003-rpmSetCloseOnExec-use-getrlimit.patch b/poky/meta/recipes-devtools/rpm/files/0003-rpmSetCloseOnExec-use-getrlimit.patch new file mode 100644 index 000000000..389b41b42 --- /dev/null +++ b/poky/meta/recipes-devtools/rpm/files/0003-rpmSetCloseOnExec-use-getrlimit.patch @@ -0,0 +1,53 @@ +From 307e28b4cb08b05bc044482058eeebc9f59bb9a9 Mon Sep 17 00:00:00 2001 +From: Kir Kolyshkin <kolyshkin@gmail.com> +Date: Tue, 29 May 2018 18:09:27 -0700 +Subject: [PATCH 3/3] rpmSetCloseOnExec: use getrlimit() + +In case /proc is not available to get the actual list of opened fds, +we fall back to iterating through the list of all possible fds. + +It is possible that during the course of the program execution the limit +on number of open file descriptors might be lowered, so using the +current limit, as returned by sysconf(_SC_OPEN_MAX), might omit some +fds. Therefore, it is better to use rlim_max from the structure +filled in by gertlimit(RLIMIT_NOFILE) to make sure we're checking +all fds. + +This slows down the function, but only in the case /proc is not +available, which should be rare in practice. + +Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> +Upstream-Status: Accepted [https://github.com/rpm-software-management/rpm/pull/444] +Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> +--- + rpmio/rpmio.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/rpmio/rpmio.c b/rpmio/rpmio.c +index 55351c221..e051c9863 100644 +--- a/rpmio/rpmio.c ++++ b/rpmio/rpmio.c +@@ -10,6 +10,7 @@ + #include <sys/personality.h> + #endif + #include <sys/utsname.h> ++#include <sys/resource.h> + + #include <rpm/rpmlog.h> + #include <rpm/rpmmacro.h> +@@ -1778,7 +1779,14 @@ void rpmSetCloseOnExec(void) + DIR *dir = opendir("/proc/self/fd"); + if (dir == NULL) { /* /proc not available */ + /* iterate over all possible fds, might be slow */ +- int open_max = sysconf(_SC_OPEN_MAX); ++ struct rlimit rl; ++ int open_max; ++ ++ if (getrlimit(RLIMIT_NOFILE, &rl) == 0 && rl.rlim_max != RLIM_INFINITY) ++ open_max = rl.rlim_max; ++ else ++ open_max = sysconf(_SC_OPEN_MAX); ++ + if (open_max == -1) + open_max = 1024; + |