uhttpd: fix a signal related race condition exposed by LuCI on fast machines
[openwrt/staging/mkresin.git] / package / uhttpd / src / uhttpd-lua.c
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);
 }
-
-