[From nobody Thu Jun 25 05:55:25 2020
Received: from mail.codigosur.net ([2a00:1508:1::1039])
 by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux))
 id 1iIgCG-0006w7-7F
 for openwrt-devel@lists.openwrt.org; Thu, 10 Oct 2019 21:42:09 +0000
Received: from authenticated-user (mail.codigosur.net [109.69.10.39])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mail.codigosur.net (Postfix) with ESMTPSA id 174998E3674;
 Thu, 10 Oct 2019 21:34:58 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=altermundi.net;
 s=mail; t=1570743300;
 bh=2cizU9r9/wtqLh4DpDv1AOX1HRwsTAZPSayeTu9GG/o=;
 h=From:To:Cc:Subject:Date:From;
 b=YB+jIs52KJog32CZLA62IjWrNAnkVp8Ga9pX2Ut1CBfJbjdSn6nMpMOfhO60Hu+4H
 kd1wYP2CBAJ0e5idvqW1Zv7W1PAZvm8OSYqLg9jKlGschsuzk1qUOjyKo6SF18mUCc
 enmS6hcog6WMrjVq6oAcwZb+BB/A+7LrLA4q/2pfrb9w5tyuE+p1EJbMkTILeydK4W
 va0pYw57Eq2d7ez+blocIv5yxB7fATc8S7a2NoeKsUgATc5KYGPjeF51LOYqXOqkXj
 hyflJmlpbP5z2XG9I+2hwhTV8nrfizv4HdQq6MT8mtC4yXfXKEpIyer6k5RV526Ugl
 rDTWEL/ID0C2g==
From: Santiago Piccinini &lt;spiccinini@altermundi.net&gt;
To: openwrt-devel@lists.openwrt.org,
	nbd@openwrt.org,
	jo@mein.io
Cc: Santiago Piccinini &lt;spiccinini@altermundi.net&gt;
Subject: [PATCH] proc: cancel script killing only if process ends
Date: Thu, 10 Oct 2019 18:35:53 -0300
Message-Id: &lt;20191010213553.90237-1-spiccinini@altermundi.net&gt;
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 
X-CRM114-CacheID: sfid-20191010_144208_470408_A1C17382 
X-CRM114-Status: UNSURE (   7.92  )
X-CRM114-Notice: Please train this message.
X-Spam-Score: -0.2 (/)
X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary:
 Content analysis details:   (-0.2 points)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.1 DKIM_SIGNED            Message has a DKIM or DK signature, not necessarily
 valid
 -0.1 DKIM_VALID_EF          Message has a valid DKIM or DK signature from
 envelope-from domain
 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
 -0.1 DKIM_VALID_AU          Message has a valid DKIM or DK signature from
 author's domain

Before this change if the cgi script hangs after writing headers
then the process will never be killed. Let's only cancel the timeout
if the process ends.

Signed-off-by: Santiago Piccinini &lt;spiccinini@altermundi.net&gt;
---
 proc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/proc.c b/proc.c
index 1d63d86..2b69703 100644
--- a/proc.c
+++ b/proc.c
@@ -225,11 +225,9 @@ static void proc_handle_header(struct relay *r, const char *name, const char *va
 static void proc_handle_header_end(struct relay *r)
 {
 	struct client *cl = r-&gt;cl;
-	struct dispatch_proc *p = &amp;cl-&gt;dispatch.proc;
 	struct blob_attr *cur;
 	int rem;
 
-	uloop_timeout_cancel(&amp;p-&gt;timeout);
 	uh_http_header(cl, cl-&gt;dispatch.proc.status_code, cl-&gt;dispatch.proc.status_msg);
 	blob_for_each_attr(cur, cl-&gt;dispatch.proc.hdr.head, rem)
 		ustream_printf(cl-&gt;us, &quot;%s: %s\r\n&quot;, blobmsg_name(cur),
-- 
2.23.0


]