From 288f29a022b6b72ec460cf5bf34a183f1b54cc4c Mon Sep 17 00:00:00 2001
From: Eric Wong <e@80x24.org>
Date: Sat, 5 Mar 2016 07:35:22 +0000
Subject: [PATCH] t/httpd-corner: avoid clobbering existing FDs after fork

Due to the deterministic way reference counting works,
we do not want to drop references to existing FDs
even if we no longer need the glob reference; the actual
FD is all we can pass through on exec.
---
 t/httpd-corner.t | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/t/httpd-corner.t b/t/httpd-corner.t
index a6238e48..833eb429 100644
--- a/t/httpd-corner.t
+++ b/t/httpd-corner.t
@@ -55,10 +55,10 @@ my $spawn_httpd = sub {
 		# pretend to be systemd
 		dup2(fileno($sock), 3) or die "dup2 failed: $!\n";
 		dup2(fileno($unix), 4) or die "dup2 failed: $!\n";
-		$sock = IO::Handle->new_from_fd(3, 'r');
-		$sock->fcntl(F_SETFD, 0);
-		$unix = IO::Handle->new_from_fd(4, 'r');
-		$unix->fcntl(F_SETFD, 0);
+		my $t = IO::Handle->new_from_fd(3, 'r');
+		$t->fcntl(F_SETFD, 0);
+		my $u = IO::Handle->new_from_fd(4, 'r');
+		$u->fcntl(F_SETFD, 0);
 		$ENV{LISTEN_PID} = $$;
 		$ENV{LISTEN_FDS} = 2;
 		exec $httpd, @args, "--stdout=$out", "--stderr=$err", $psgi;
-- 
2.50.0