[4.1] c330106 Bail out of CLI reads on signals

PÃ¥l Hermunn Johansen hermunn at varnish-software.com
Tue Oct 25 11:09:04 CEST 2016


commit c3301061ee62ec61f0672630e67ab4fc4bf81076
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Oct 24 14:53:27 2016 +0000

    Bail out of CLI reads on signals
    
    Spotted & prodded by: 	Hermunn
    Closes: #2026

diff --git a/lib/libvarnish/cli_common.c b/lib/libvarnish/cli_common.c
index d14611f..895705f 100644
--- a/lib/libvarnish/cli_common.c
+++ b/lib/libvarnish/cli_common.c
@@ -155,6 +155,10 @@ read_tmo(int fd, char *ptr, unsigned len, double tmo)
 	pfd.events = POLLIN;
 	for (j = 0; len > 0; ) {
 		i = poll(&pfd, 1, to);
+		if (i < 0) {
+			errno = EINTR;
+			return (-1);
+		}
 		if (i == 0) {
 			errno = ETIMEDOUT;
 			return (-1);



More information about the varnish-commit mailing list