about summary refs log tree commit homepage
path: root/lib/PublicInbox/GitHTTPBackend.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-09-12 08:34:20 +0000
committerEric Wong <e@80x24.org>2019-09-14 09:24:23 +0000
commite5631087d3862823d0d4854a8dfc1258f91cb115 (patch)
treecbb6b7bf2c117fc8550f20c12116582933351131 /lib/PublicInbox/GitHTTPBackend.pm
parentbb20bc29a831d8f84613d48af729ffaede9d43e2 (diff)
downloadpublic-inbox-e5631087d3862823d0d4854a8dfc1258f91cb115.tar.gz
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.
Diffstat (limited to 'lib/PublicInbox/GitHTTPBackend.pm')
-rw-r--r--lib/PublicInbox/GitHTTPBackend.pm4
1 files changed, 3 insertions, 1 deletions
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;