From b552bb9150775fe4b5a9eb76803e8859c647be92 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 13 Jan 2021 19:06:16 -1200 Subject: daemon+watch: fix localization of %SIG for non-signalfd users It turns out "local" did not take effect in the way we used it: http://nntp.perl.org/group/perl.perl5.porters/258784 Fortunately, none of the old use cases seem affected, unlike the previous lei change to ensure consistent SIGPIPE handling. --- lib/PublicInbox/Daemon.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/PublicInbox/Daemon.pm') diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm index 4b738b7c..f5543c85 100644 --- a/lib/PublicInbox/Daemon.pm +++ b/lib/PublicInbox/Daemon.pm @@ -514,7 +514,7 @@ EOF CHLD => \&reap_children, }; my $sigfd = PublicInbox::Sigfd->new($sig, 0); - local %SIG = (%SIG, %$sig) if !$sigfd; + local @SIG{keys %$sig} = values(%$sig) unless $sigfd; PublicInbox::DS::sig_setmask($oldset) if !$sigfd; while (1) { # main loop my $n = scalar keys %pids; @@ -628,7 +628,7 @@ sub daemon_loop ($$$$) { PublicInbox::Listener->new($_, $tls_cb || $post_accept) } @listeners; my $sigfd = PublicInbox::Sigfd->new($sig, SFD_NONBLOCK); - local %SIG = (%SIG, %$sig) if !$sigfd; + local @SIG{keys %$sig} = values(%$sig) unless $sigfd; if (!$sigfd) { # wake up every second to accept signals if we don't # have signalfd or IO::KQueue: -- cgit v1.2.3-24-ge0c7