[master] 6c510ef79 signal handling for varnishstat in curses mode

Nils Goroll nils.goroll at uplex.de
Fri Oct 11 10:27:07 UTC 2019


commit 6c510ef79dd684d23c136d065b40ee6f355cd595
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Fri Oct 11 11:13:56 2019 +0200

    signal handling for varnishstat in curses mode
    
    Fixes #3088 for varnishstat
    
    note that besides handling SIGHUP, this also adds handling of SIGTERM
    and SIGINT, which were also missing.

diff --git a/bin/varnishstat/varnishstat_curses.c b/bin/varnishstat/varnishstat_curses.c
index 1038f0200..a97fe0c62 100644
--- a/bin/varnishstat/varnishstat_curses.c
+++ b/bin/varnishstat/varnishstat_curses.c
@@ -45,6 +45,7 @@
 #include "miniobj.h"
 #include "vqueue.h"
 #include "vtim.h"
+#include "vapi/vsig.h"
 
 #include "varnishstat.h"
 #include "vcurses.h"
@@ -1032,7 +1033,7 @@ do_curses(struct vsm *vsm, struct vsc *vsc)
 	build_pt_array();
 	init_hitrate();
 
-	while (keep_running) {
+	while (keep_running && !VSIG_int && !VSIG_term && !VSIG_hup) {
 		(void)VSC_Iter(vsc, vsm, NULL, NULL);
 		vsm_status = VSM_Status(vsm);
 		if (vsm_status & (VSM_MGT_RESTARTED|VSM_WRK_RESTARTED))


More information about the varnish-commit mailing list