aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/uwsgi/APKBUILD6
-rw-r--r--main/uwsgi/close-fd.patch28
2 files changed, 32 insertions, 2 deletions
diff --git a/main/uwsgi/APKBUILD b/main/uwsgi/APKBUILD
index c2e57c48aae..8fa364d9a18 100644
--- a/main/uwsgi/APKBUILD
+++ b/main/uwsgi/APKBUILD
@@ -4,7 +4,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=uwsgi
pkgver=2.0.18
-pkgrel=7
+pkgrel=8
pkgdesc="uWSGI application container server"
url="http://projects.unbit.it/uwsgi/"
arch="all"
@@ -39,6 +39,7 @@ source="http://projects.unbit.it/downloads/uwsgi-$pkgver.tar.gz
alpine.buildconf
musl-fix-python.patch
musl-ucontext.patch
+ close-fd.patch
"
options="!check"
@@ -214,4 +215,5 @@ sha512sums="6561703279bcc4a81311d033810ac066d0f113bab13b0942f3eef86cac29c584a664
2798c9d2e49e29292ffe6a5a29b866301c78d5f322fc5d07dfa9569efdaa5220237a5f6744652fbdd957be29311ddaff190541333f042cbf0e907dfa98ce3e2a readme.emperor
f3cff00926929a5bb40afafb65fd5228582af35fbf524562282020c4c4ae9c659231b2381f4b3cceb18e8f3f6c888c21bdd8ed4ddcd81e92fbc6a0891800ce38 alpine.buildconf
de68b16b44e554a79c073c9befa10566796316dbf4c375b4d6b633d80b0282694cca233f0a70f3d6570584324f14276826bbeb8f38b550c00087a05f9ba9227f musl-fix-python.patch
-d4b93e51619af5f8839cdc7279c69462947910df03104cfe6180d606403940fc60ad5dac66425ce8acbab67cc0c4f3e13126da0a329720cb03c67d447cd94ad9 musl-ucontext.patch"
+d4b93e51619af5f8839cdc7279c69462947910df03104cfe6180d606403940fc60ad5dac66425ce8acbab67cc0c4f3e13126da0a329720cb03c67d447cd94ad9 musl-ucontext.patch
+be5859c38101f34630fbe0cce4213565fc4d8dd6c63dcc47fd44fa36c001b437677795db9abb470bcd522861c4936d49c43422846e0a8fff8730eac4ce8d75d3 close-fd.patch"
diff --git a/main/uwsgi/close-fd.patch b/main/uwsgi/close-fd.patch
new file mode 100644
index 00000000000..d72940298c5
--- /dev/null
+++ b/main/uwsgi/close-fd.patch
@@ -0,0 +1,28 @@
+diff --git a/plugins/cgi/cgi_plugin.c b/plugins/cgi/cgi_plugin.c
+index d640b5e5..1e687002 100644
+--- a/plugins/cgi/cgi_plugin.c
++++ b/plugins/cgi/cgi_plugin.c
+@@ -793,8 +793,21 @@ clear2:
+ close(cgi_pipe[1]);
+
+ // close all the fd > 2
+- for(i=3;i<(int)uwsgi.max_fd;i++) {
+- close(i);
++ DIR *dirp = opendir("/proc/self/fd");
++ if (dirp == NULL)
++ dirp = opendir("/dev/fd");
++ if (dirp != NULL) {
++ struct dirent *dent;
++ while ((dent = readdir(dirp)) != NULL) {
++ int fd = atoi(dent->d_name);
++ if ((fd > 2) && fd != dirfd(dirp))
++ close(fd);
++ }
++ closedir(dirp);
++ } else {
++ for(i=3;i<(int)uwsgi.max_fd;i++) {
++ close(i);
++ }
+ }
+
+ // fill cgi env