diff options
Diffstat (limited to 'lib/PublicInbox/SearchIdxPart.pm')
-rw-r--r-- | lib/PublicInbox/SearchIdxPart.pm | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/PublicInbox/SearchIdxPart.pm b/lib/PublicInbox/SearchIdxPart.pm index 5582d672..64e52636 100644 --- a/lib/PublicInbox/SearchIdxPart.pm +++ b/lib/PublicInbox/SearchIdxPart.pm @@ -14,10 +14,7 @@ sub new { my $pid = fork; defined $pid or die "fork failed: $!\n"; if ($pid == 0) { - foreach my $other (@{$v2writable->{idx_parts}}) { - my $other_w = $other->{w} or next; - close $other_w or die "close other failed: $!\n"; - } + $v2writable->atfork_child; $v2writable = undef; close $w; @@ -74,4 +71,8 @@ sub index_raw { $w->flush or die "failed to flush: $!\n"; } +sub atfork_child { + close $_[0]->{w} or die "failed to close write pipe: $!\n"; +} + 1; |