Commit Diff


commit - a8a1f439210de9538b196c6bb5470c306379128c
commit + e7c6502bf3ebe199349e315ac7f112db6a2db38e
blob - 8e25bd13254a1e570f1f8a04f3fc9ca2bb721b73
blob + cad8d9ab36cb1b75fecdf15277c3a2f92a05db8c
--- ex.c
+++ ex.c
@@ -137,6 +137,11 @@ launch_cgi(struct iri *iri, struct cgireq *req, struct
 
 	switch (fork()) {
 	case -1:
+		log_err(NULL, "fork failed: %s", strerror(errno));
+		close(p[0]);
+		close(p[1]);
+		close(errp[0]);
+		close(errp[1]);
 		return -1;
 
 	case 0: {		/* child */
@@ -230,6 +235,7 @@ launch_cgi(struct iri *iri, struct cgireq *req, struct
 
 	default:
 		close(p[1]);
+		close(errp[0]);
 		close(errp[1]);
 		mark_nonblock(p[0]);
 		return p[0];