From: Eric Wong Date: Fri, 6 Aug 2021 00:29:52 +0000 (+0000) Subject: li2wrap: avoid double-close on Linux::Inotify2 <2.3 X-Git-Tag: v1.7.0~521 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=5d3e9705c8d5a6d0341a5f1bed2027ef9f9e95a8;hp=a29946ad3bc49704a512ae3ab31a45bbd66165e2;p=public-inbox.git li2wrap: avoid double-close on Linux::Inotify2 <2.3 LI2Wrap was not working as expected due to the missing bless to override ->DESTROY. This bug showed up in an message check in t/lei-q-remote-import.t Fixes: 7fc6e30aeab9925b ("lei: close inotify FD in forked child") --- diff --git a/lib/PublicInbox/LI2Wrap.pm b/lib/PublicInbox/LI2Wrap.pm index 61cf4bee..204850a6 100644 --- a/lib/PublicInbox/LI2Wrap.pm +++ b/lib/PublicInbox/LI2Wrap.pm @@ -12,6 +12,7 @@ sub wrapclose { my ($inot) = @_; my $fd = $inot->fileno; open my $fh, '<&=', $fd or die "open <&= $fd $!"; + bless $inot, __PACKAGE__; } sub DESTROY {} # no-op