[6.0] 86326f95b Make sure daemonized haproxy processes gets killed

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Aug 16 08:52:50 UTC 2018


commit 86326f95bf598b180715e9e3e098e916b344a2a3
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Apr 26 08:29:21 2018 +0000

    Make sure daemonized haproxy processes gets killed

diff --git a/bin/varnishtest/vtc_haproxy.c b/bin/varnishtest/vtc_haproxy.c
index 8d4118fe5..35dd2e898 100644
--- a/bin/varnishtest/vtc_haproxy.c
+++ b/bin/varnishtest/vtc_haproxy.c
@@ -327,15 +327,16 @@ haproxy_wait(struct haproxy *h)
 	sig = SIGINT;
 	n = 0;
 	vtc_log(h->vl, 2, "Stop HAproxy pid=%ld", (long)h->pid);
-	while (!h->opt_check_mode && !h->its_dead_jim) {
+	while (h->opt_daemon || (!h->opt_check_mode && !h->its_dead_jim)) {
 		assert(h->pid > 0);
 		if (n == 0) {
-			i= kill(h->pid, sig);
-			vtc_log(h->vl, 4,
-			    "Kill(%d)=%d: %s", sig, i, strerror(errno));
-			h->expect_signal = -sig;
+			i = kill(h->pid, sig);
+			if (i == 0)
+				h->expect_signal = -sig;
 			if (i && errno == ESRCH)
 				break;
+			vtc_log(h->vl, 4,
+			    "Kill(%d)=%d: %s", sig, i, strerror(errno));
 		}
 		usleep(100000);
 		if (++n == 20) {


More information about the varnish-commit mailing list