From: Eric Wong Date: Tue, 23 Dec 2025 01:24:52 +0000 (+0000) Subject: xapcmd: ensure SIGPIPE fails in children X-Git-Tag: v2.1.0~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33fc1e2493afef024ac4c040223ccd765cc3cd45;p=thirdparty%2Fpublic-inbox.git xapcmd: ensure SIGPIPE fails in children 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. --- diff --git a/lib/PublicInbox/Xapcmd.pm b/lib/PublicInbox/Xapcmd.pm index 476c6c499..ede354f42 100644 --- a/lib/PublicInbox/Xapcmd.pm +++ b/lib/PublicInbox/Xapcmd.pm @@ -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);