From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.9 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: meta@public-inbox.org Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 0394F1F4E2; Sat, 5 Mar 2016 07:38:42 +0000 (UTC) Date: Sat, 5 Mar 2016 07:38:42 +0000 From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] t/httpd-corner: avoid clobbering existing FDs after fork Message-ID: <20160305073842.GA19330@dcvr.yhbt.net> References: <20160303103302.29161-1-e@80x24.org> <20160304004312.GA10773@dcvr.yhbt.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160304004312.GA10773@dcvr.yhbt.net> List-Id: 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 a6238e4..833eb42 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; -- EW