From e5631087d3862823d0d4854a8dfc1258f91cb115 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 12 Sep 2019 08:34:20 +0000 Subject: tmpfile: give temporary files meaningful names Although we always unlink temporary files, give them a meaningful name so that we can we can still make sense of the pre-unlink name when using lsof(8) or similar tools on Linux. --- lib/PublicInbox/GitHTTPBackend.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/PublicInbox/GitHTTPBackend.pm') diff --git a/lib/PublicInbox/GitHTTPBackend.pm b/lib/PublicInbox/GitHTTPBackend.pm index c8878145..a8337035 100644 --- a/lib/PublicInbox/GitHTTPBackend.pm +++ b/lib/PublicInbox/GitHTTPBackend.pm @@ -12,6 +12,7 @@ use HTTP::Date qw(time2str); use HTTP::Status qw(status_message); use Plack::Util; use PublicInbox::Qspawn; +use PublicInbox::Tmpfile; # 32 is same as the git-daemon connection limit my $default_limiter = PublicInbox::Qspawn::Limiter->new(32); @@ -218,7 +219,8 @@ sub input_prepare { if (defined $fd && $fd >= 0) { return { 0 => $fd }; } - open(my $in, '+>', undef); + my $id = "git-http.input.$env->{REMOTE_HOST}:$env->{REMOTE_PORT}"; + my $in = tmpfile($id); unless (defined $in) { err($env, "could not open temporary file: $!"); return; -- cgit v1.2.3-24-ge0c7