[master] 76773e7c5 fix insignificant off-by-one in child file descriptor close code

Nils Goroll nils.goroll at uplex.de
Thu Nov 22 12:29:14 UTC 2018


commit 76773e7c51c44817de3a65a132806e5b525689b9
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Thu Nov 22 13:21:24 2018 +0100

    fix insignificant off-by-one in child file descriptor close code
    
    The name CLOSE_FD_UP_TO implies that the value is included.
    
    Also this is the semantics of MCH_TrackHighFd() and relevant for
     #define CLOSE_FD_UP_TO mgt_max_fd

diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c
index 99485af83..5072db159 100644
--- a/bin/varnishd/mgt/mgt_child.c
+++ b/bin/varnishd/mgt/mgt_child.c
@@ -342,7 +342,7 @@ mgt_launch_child(struct cli *cli)
 		 */
 		closelog();
 
-		for (i = STDERR_FILENO + 1; i < CLOSE_FD_UP_TO; i++) {
+		for (i = STDERR_FILENO + 1; i <= CLOSE_FD_UP_TO; i++) {
 			if (vbit_test(fd_map, i))
 				continue;
 			if (close(i) == 0)


More information about the varnish-commit mailing list