]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Watch.pm
doc: re-add missing 1.6 release notes
[public-inbox.git] / lib / PublicInbox / Watch.pm
index bc296e01fc3ac7baec4e50dc082e7aef59457a2e..1de5018d0230b1a4bee9d96080dd30cdaa4b9fdb 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2020 all contributors <meta@public-inbox.org>
+# Copyright (C) 2016-2021 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 #
 # ref: https://cr.yp.to/proto/maildir.html
@@ -583,13 +583,13 @@ sub watch_atfork_child ($) {
        delete $self->{opendirs};
        PublicInbox::DS->Reset;
        %SIG = (%SIG, %{$self->{sig}}, CHLD => 'DEFAULT');
-       PublicInbox::Sigfd::sig_setmask($self->{oldset});
+       PublicInbox::DS::sig_setmask($self->{oldset});
 }
 
 sub watch_atfork_parent ($) {
        my ($self) = @_;
        _done_for_now($self);
-       PublicInbox::Sigfd::block_signals();
+       PublicInbox::DS::block_signals();
 }
 
 sub imap_idle_requeue ($) { # DS::add_timer callback
@@ -625,8 +625,11 @@ sub imap_idle_fork ($$) {
        my ($self, $url_intvl) = @_;
        my ($url, $intvl) = @$url_intvl;
        pipe(my ($r, $w)) or die "pipe: $!";
+       my $seed = rand(0xffffffff);
        defined(my $pid = fork) or die "fork: $!";
        if ($pid == 0) {
+               srand($seed);
+               eval { Net::SSLeay::randomize() };
                close $r;
                watch_atfork_child($self);
                watch_imap_idle_1($self, $url, $intvl);
@@ -648,7 +651,7 @@ sub event_step {
                                imap_idle_fork($self, $url_intvl);
                        }
                };
-               PublicInbox::Sigfd::sig_setmask($oldset);
+               PublicInbox::DS::sig_setmask($oldset);
                die $@ if $@;
        }
        fs_scan_step($self) if $self->{mdre};
@@ -704,8 +707,11 @@ sub poll_fetch_fork ($) { # DS::add_timer callback
        return if $self->{quit};
        pipe(my ($r, $w)) or die "pipe: $!";
        my $oldset = watch_atfork_parent($self);
+       my $seed = rand(0xffffffff);
        my $pid = fork;
        if (defined($pid) && $pid == 0) {
+               srand($seed);
+               eval { Net::SSLeay::randomize() };
                close $r;
                watch_atfork_child($self);
                if ($urls->[0] =~ m!\Aimaps?://!i) {
@@ -716,7 +722,7 @@ sub poll_fetch_fork ($) { # DS::add_timer callback
                close $w;
                _exit(0);
        }
-       PublicInbox::Sigfd::sig_setmask($oldset);
+       PublicInbox::DS::sig_setmask($oldset);
        die "fork: $!"  unless defined $pid;
        $self->{poll_pids}->{$pid} = [ $intvl, $urls ];
        PublicInbox::EOFpipe->new($r, \&reap, [$pid, \&poll_fetch_reap, $self]);