summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2012-06-18 00:41:43 +0000
committerJo-Philipp Wich <jow@openwrt.org>2012-06-18 00:41:43 +0000
commitc73b39fd302245a47813d1a41a082df7b82c45fb (patch)
treeba2e5ccab10d9f4f116b09f56bb4f6b24fe3f3b1
parentfd38f78bfe8a58cade2a902e53a6f38dc9224772 (diff)
downloadmtk-20170518-c73b39fd302245a47813d1a41a082df7b82c45fb.zip
mtk-20170518-c73b39fd302245a47813d1a41a082df7b82c45fb.tar.gz
mtk-20170518-c73b39fd302245a47813d1a41a082df7b82c45fb.tar.bz2
uhttpd: finish inherited uloop in forked childs, fixes misdispatched events leading to race conditions and bad memory accesses
SVN-Revision: 32419
-rw-r--r--package/uhttpd/Makefile2
-rw-r--r--package/uhttpd/src/uhttpd-cgi.c3
-rw-r--r--package/uhttpd/src/uhttpd-lua.c3
3 files changed, 7 insertions, 1 deletions
diff --git a/package/uhttpd/Makefile b/package/uhttpd/Makefile
index 9d8f9fa..b8afa0d 100644
--- a/package/uhttpd/Makefile
+++ b/package/uhttpd/Makefile
@@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=uhttpd
-PKG_RELEASE:=35
+PKG_RELEASE:=36
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
PKG_CONFIG_DEPENDS := \
diff --git a/package/uhttpd/src/uhttpd-cgi.c b/package/uhttpd/src/uhttpd-cgi.c
index ee1b80c..8336a1b 100644
--- a/package/uhttpd/src/uhttpd-cgi.c
+++ b/package/uhttpd/src/uhttpd-cgi.c
@@ -365,6 +365,9 @@ bool uh_cgi_request(struct client *cl, struct path_info *pi,
sleep(atoi(getenv("UHTTPD_SLEEP_ON_FORK") ?: "0"));
#endif
+ /* do not leak parent epoll descriptor */
+ uloop_done();
+
/* close loose pipe ends */
close(rfd[0]);
close(wfd[1]);
diff --git a/package/uhttpd/src/uhttpd-lua.c b/package/uhttpd/src/uhttpd-lua.c
index 0b91b34..5158534 100644
--- a/package/uhttpd/src/uhttpd-lua.c
+++ b/package/uhttpd/src/uhttpd-lua.c
@@ -397,6 +397,9 @@ bool uh_lua_request(struct client *cl, lua_State *L)
sleep(atoi(getenv("UHTTPD_SLEEP_ON_FORK") ?: "0"));
#endif
+ /* do not leak parent epoll descriptor */
+ uloop_done();
+
/* close loose pipe ends */
close(rfd[0]);
close(wfd[1]);