about summary refs log tree commit homepage
path: root/lib/PublicInbox/Emergency.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/Emergency.pm')
-rw-r--r--lib/PublicInbox/Emergency.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/PublicInbox/Emergency.pm b/lib/PublicInbox/Emergency.pm
index 231b4197..66adc631 100644
--- a/lib/PublicInbox/Emergency.pm
+++ b/lib/PublicInbox/Emergency.pm
@@ -18,7 +18,7 @@ sub new {
                 next if -d $d;
                 -d $d or mkdir($d) or die "failed to mkdir($d): $!\n";
         }
-        bless { dir => $dir, files => {}, t => 0, cnt => 0 }, $class;
+        bless { dir => $dir, files => {}, t => 0, cnt => 0, pid => $$ }, $class;
 }
 
 sub _fn_in {
@@ -75,6 +75,7 @@ sub fh {
 
 sub commit {
         my ($self) = @_;
+        $$ == $self->{pid} or return; # no-op in forked child
 
         delete $self->{fh};
         my $tmp = delete $self->{tmp} or return;