uhttpd: fix a signal related race condition exposed by LuCI on fast machines
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 29 Mar 2010 09:26:02 +0000 (09:26 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 29 Mar 2010 09:26:02 +0000 (09:26 +0000)
SVN-Revision: 20573

package/uhttpd/Makefile
package/uhttpd/src/uhttpd-cgi.c
package/uhttpd/src/uhttpd-lua.c

index 4bee17d234086f0305bc03f39915e0666233b003..180e2284c3f1a904e9c523078e5aa39aa50ca325 100644 (file)
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=uhttpd
-PKG_RELEASE:=5
+PKG_RELEASE:=6
 
 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
 
index 28686b47e27c286c433adeba187d3f257ea3f2aa..1a6c6ad4febc3eed64e14bcd8b7c983eb994e568 100644 (file)
@@ -562,7 +562,10 @@ void uh_cgi_request(struct client *cl, struct http_request *req, struct path_inf
                        close(wfd[1]);
 
                        if( !kill(child, 0) )
+                       {
                                kill(child, SIGTERM);
+                               waitpid(child, NULL, 0);
+                       }
 
                        break;
        }
index b3f3cb498f75cb5e10ca8ef25b3eeaa5410d5e55..c2efe33849557a5e6f90b94c3afa221fdd223618 100644 (file)
@@ -533,7 +533,10 @@ void uh_lua_request(struct client *cl, struct http_request *req, lua_State *L)
                        close(wfd[1]);
 
                        if( !kill(child, 0) )
+                       {
                                kill(child, SIGTERM);
+                               waitpid(child, NULL, 0);
+                       }
 
                        break;
        }
@@ -543,5 +546,3 @@ void uh_lua_close(lua_State *L)
 {
        lua_close(L);
 }
-
-