From 9ff1f777cda255d8c9b9224b69241aad7c297db5 Mon Sep 17 00:00:00 2001 From: "Eric Wong (Contractor, The Linux Foundation)" Date: Fri, 23 Feb 2018 02:26:45 +0000 Subject: v2writable: cleanup unused pipes in partitions Leaking these pipes to child processes wasn't harmful, but made determining relationships and dataflow between processes more confusing. --- lib/PublicInbox/SearchIdxPart.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/PublicInbox/SearchIdxPart.pm') 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; -- cgit v1.2.3-24-ge0c7