From: Eric Wong Date: Sat, 5 Mar 2016 07:35:22 +0000 (+0000) Subject: t/httpd-corner: avoid clobbering existing FDs after fork X-Git-Tag: v1.0.0~645 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=288f29a022b6b72ec460cf5bf34a183f1b54cc4c;p=public-inbox.git 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. --- 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;