about summary refs log tree commit homepage
path: root/lib/PublicInbox/Watch.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-09-04 10:36:03 +0000
committerEric Wong <e@80x24.org>2023-09-05 03:01:39 +0000
commit078ad3d512f5b07ef491adae284350f79f4ae656 (patch)
tree2d446900fc94310bde32cf5493e1a9fdf386bf10 /lib/PublicInbox/Watch.pm
parentbcd3e39ad12d284acc337707c756f374e036aa1f (diff)
downloadpublic-inbox-078ad3d512f5b07ef491adae284350f79f4ae656.tar.gz
Blindly using the signal set inherited from the parent process
is wrong, since the parent (or grandparent) could've blocked all
signals.  Ensure children can process signals in the event loop
when sig handlers have to use standard Perl facilities.
Diffstat (limited to 'lib/PublicInbox/Watch.pm')
-rw-r--r--lib/PublicInbox/Watch.pm7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/PublicInbox/Watch.pm b/lib/PublicInbox/Watch.pm
index c3b5b791..a2dc125f 100644
--- a/lib/PublicInbox/Watch.pm
+++ b/lib/PublicInbox/Watch.pm
@@ -389,7 +389,7 @@ sub watch_atfork_child ($) {
         my $sig = delete $self->{sig};
         $sig->{CHLD} = 'DEFAULT';
         @SIG{keys %$sig} = values %$sig;
-        PublicInbox::DS::sig_setmask($self->{oldset});
+        PublicInbox::DS::sig_setmask(PublicInbox::DS::allowset($sig));
 }
 
 sub watch_atfork_parent ($) { _done_for_now($_[0]) }
@@ -533,8 +533,7 @@ sub watch_nntp_init ($$) {
 }
 
 sub watch { # main entry point
-        my ($self, $sig, $oldset) = @_;
-        $self->{oldset} = $oldset;
+        my ($self, $sig) = @_;
         my $first_sig;
         $self->{sig} //= ($first_sig = $sig);
         my $poll = {}; # intvl_seconds => [ uri1, uri2 ]
@@ -546,7 +545,7 @@ sub watch { # main entry point
         }
         watch_fs_init($self) if $self->{mdre};
         local @PublicInbox::DS::post_loop_do = (sub { !$self->quit_done });
-        PublicInbox::DS::event_loop($first_sig, $oldset); # calls ->event_step
+        PublicInbox::DS::event_loop($first_sig); # calls ->event_step
         _done_for_now($self);
 }