diff options
author | Eric Wong <e@80x24.org> | 2023-10-17 23:37:54 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-10-18 20:50:26 +0000 |
commit | 33fe12fa12259c61bd15efc54446334e2e28d67b (patch) | |
tree | d962d76124f8329264d2620607ddefe00c13f335 /lib/PublicInbox/XapHelper.pm | |
parent | de88c4a4443eae433f17c717af26c987cdbcaac4 (diff) | |
download | public-inbox-33fe12fa12259c61bd15efc54446334e2e28d67b.tar.gz |
We don't need to tolerate bad requests since it's only handling requests from the parent process. So simplify error management and just die||exit if we get a bad request.
Diffstat (limited to 'lib/PublicInbox/XapHelper.pm')
-rw-r--r-- | lib/PublicInbox/XapHelper.pm | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/PublicInbox/XapHelper.pm b/lib/PublicInbox/XapHelper.pm index ca993ca8..fe8d20f4 100644 --- a/lib/PublicInbox/XapHelper.pm +++ b/lib/PublicInbox/XapHelper.pm @@ -13,6 +13,7 @@ use PublicInbox::IPC; use PublicInbox::Git qw(read_all); use Socket qw(SOL_SOCKET SO_TYPE SOCK_SEQPACKET AF_UNIX); use PublicInbox::DS qw(awaitpid); +use autodie qw(open); use POSIX qw(:signal_h); use Fcntl qw(LOCK_UN LOCK_EX); my $X = \%PublicInbox::Search::X; @@ -122,7 +123,7 @@ sub cmd_dump_roots { $qry_str // return warn('usage: dump_roots [OPTIONS] ROOT2ID_FILE QRY_STR'); $req->{A} or return warn('dump_roots requires -A PREFIX'); - open my $fh, '<', $root2id_file or die "open($root2id_file): $!"; + open my $fh, '<', $root2id_file; my $root2id; # record format: $OIDHEX "\0" uint32_t my @x = split(/\0/, read_all($fh)); while (@x) { @@ -184,13 +185,7 @@ sub recv_loop { PublicInbox::DS::block_signals(); my $req = bless {}, __PACKAGE__; my $i = 0; - for my $fd (@fds) { - open($req->{$i++}, '+<&=', $fd) and next; - warn("open(+<&=$fd) (FD=$i): $!"); - undef $req; - last; - } - $req or next; + open($req->{$i++}, '+<&=', $_) for @fds; local $stderr = $req->{1} // \*STDERR; if (chop($rbuf) ne "\0") { warn "not NUL-terminated"; |