about summary refs log tree commit homepage
path: root/lib/PublicInbox/SolverGit.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/SolverGit.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/SolverGit.pm')
-rw-r--r--lib/PublicInbox/SolverGit.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/PublicInbox/SolverGit.pm b/lib/PublicInbox/SolverGit.pm
index 49f94895..8878961e 100644
--- a/lib/PublicInbox/SolverGit.pm
+++ b/lib/PublicInbox/SolverGit.pm
@@ -15,6 +15,7 @@ use Fcntl qw(SEEK_SET);
 use PublicInbox::Git qw(git_unquote git_quote);
 use PublicInbox::MsgIter qw(msg_iter msg_part_text);
 use PublicInbox::Qspawn;
+use PublicInbox::Tmpfile;
 use URI::Escape qw(uri_escape_utf8);
 
 # POSIX requires _POSIX_ARG_MAX >= 4096, and xargs is required to
@@ -235,7 +236,7 @@ sub prepare_index ($) {
         my $path_a = $di->{path_a} or die "BUG: path_a missing for $oid_full";
         my $mode_a = $di->{mode_a} || extract_old_mode($di);
 
-        open my $in, '+>', undef or die "open: $!";
+        my $in = tmpfile("update-index.$oid_full") or die "tmpfile: $!";
         print $in "$mode_a $oid_full\t$path_a\0" or die "print: $!";
         $in->flush or die "flush: $!";
         sysseek($in, 0, 0) or die "seek: $!";