unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH] t/httpd-corner: avoid clobbering existing FDs after fork
Date: Sat, 5 Mar 2016 07:38:42 +0000	[thread overview]
Message-ID: <20160305073842.GA19330@dcvr.yhbt.net> (raw)
In-Reply-To: <20160304004312.GA10773@dcvr.yhbt.net>

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

      reply	other threads:[~2016-03-05  7:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-03 10:33 [PATCH] daemon: support listening on Unix domain sockets Eric Wong
2016-03-04  0:43 ` [PATCH v2] " Eric Wong
2016-03-05  7:38   ` Eric Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160305073842.GA19330@dcvr.yhbt.net \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).