From 8b02454634d0b2b188608a48a39da51b32ab67ed Mon Sep 17 00:00:00 2001
From: Andy Green <andy@warmcat.com>
Date: Wed, 4 May 2016 12:23:27 +0800
Subject: [PATCH] cgi add generic wait as antizombie defence

Signed-off-by: Andy Green <andy@warmcat.com>
---
 lib/libwebsockets.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c
index 60da78ef..400f6559 100644
--- a/lib/libwebsockets.c
+++ b/lib/libwebsockets.c
@@ -2305,6 +2305,11 @@ lws_cgi_kill_terminated(struct lws_context_per_thread *pt)
 	}
 #endif
 
+	/* general anti zombie defence */
+	n = waitpid(-1, &status, WNOHANG);
+	if (n > 0)
+		lwsl_notice("%s: anti-zombie wait says %d\n", __func__, n);
+
 	return 0;
 }
 #endif
-- 
GitLab