Browse Source

uhttpd: fix a signal related race condition exposed by LuCI on fast machines

SVN-Revision: 20573
Jo-Philipp Wich 16 years ago
parent
commit
b95360d5bc
3 changed files with 7 additions and 3 deletions
  1. 1 1
      package/uhttpd/Makefile
  2. 3 0
      package/uhttpd/src/uhttpd-cgi.c
  3. 3 2
      package/uhttpd/src/uhttpd-lua.c

+ 1 - 1
package/uhttpd/Makefile

@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=uhttpd
-PKG_RELEASE:=5
+PKG_RELEASE:=6
 
 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
 

+ 3 - 0
package/uhttpd/src/uhttpd-cgi.c

@@ -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;
 	}

+ 3 - 2
package/uhttpd/src/uhttpd-lua.c

@@ -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);
 }
-
-