From: Eric Wong Date: Tue, 17 Oct 2023 23:37:57 +0000 (+0000) Subject: xap_client: autodie for pipe and socketpair X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d1eea1a2cbe4586c4c0589f5f01b8326de5e6d4;p=thirdparty%2Fpublic-inbox.git xap_client: autodie for pipe and socketpair This saves us a few lines of code. --- diff --git a/lib/PublicInbox/XapClient.pm b/lib/PublicInbox/XapClient.pm index 9e2d71a02..21c892654 100644 --- a/lib/PublicInbox/XapClient.pm +++ b/lib/PublicInbox/XapClient.pm @@ -11,14 +11,12 @@ use v5.12; use PublicInbox::Spawn qw(spawn); use Socket qw(AF_UNIX SOCK_SEQPACKET); use PublicInbox::IPC; +use autodie qw(pipe socketpair); sub mkreq { my ($self, $ios, @arg) = @_; - my ($r, $w, $n); - if (!defined($ios->[0])) { - pipe($r, $w) or die "pipe: $!"; - $ios->[0] = $w; - } + my ($r, $n); + pipe($r, $ios->[0]) if !defined($ios->[0]); my @fds = map fileno($_), @$ios; my $buf = join("\0", @arg, ''); $n = $PublicInbox::IPC::send_cmd->($self->{io}, \@fds, $buf, 0) // @@ -29,8 +27,7 @@ sub mkreq { sub start_helper { my @argv = @_; - socketpair(my $sock, my $in, AF_UNIX, SOCK_SEQPACKET, 0) or - die "socketpair: $!"; + socketpair(my $sock, my $in, AF_UNIX, SOCK_SEQPACKET, 0); my $cls = ($ENV{PI_NO_CXX} ? undef : eval { require PublicInbox::XapHelperCxx; PublicInbox::XapHelperCxx::check_build();