]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
xapcmd: ensure SIGPIPE fails in children master
authorEric Wong <e@80x24.org>
Tue, 23 Dec 2025 01:24:52 +0000 (01:24 +0000)
committerEric Wong <e@80x24.org>
Wed, 24 Dec 2025 18:34:51 +0000 (18:34 +0000)
The parent process may've ignored SIGPIPE, but we need to ensure
the children fail properly on SIGPIPE since `warn' (and any
writes to stderr) may fail.

lib/PublicInbox/Xapcmd.pm

index 476c6c4994642d1bff66b5a7cf5036629e3601f4..ede354f4281b2892ac746c0f880778d5bddc0a82 100644 (file)
@@ -146,6 +146,7 @@ sub cb_spawn ($$$$) {
        my ($cb, $ibxish, $args, $opt) = @_; # $cb = cpdb() or compact()
        my $pid = PublicInbox::DS::fork_persist;
        return $pid if $pid > 0;
+       $SIG{PIPE} = 'DEFAULT'; # warn may fail
        $SIG{__DIE__} = sub { warn @_; _exit(1) }; # don't jump up stack
        $cb->($ibxish, $args, $opt);
        _exit(0);