[master] b2155ae Make sure daemonized haproxy processes gets killed

Poul-Henning Kamp phk at FreeBSD.org
Thu Apr 26 08:31:11 UTC 2018


commit b2155ae46d0887526a51cefd81ac33eddd39f141
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 8d4118f..35dd2e8 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