From 215e2138c99d48e2061eb98aef5a6da1bc3ff828 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 23 Mar 2022 08:54:34 +0000 Subject: recv_cmd: do not undef recvmsg buffer arg on errors It's a waste of ops and cycles, and inconsistent with perl sysread() behavior which doesn't touch the supplied buffer on errors. --- lib/PublicInbox/CmdIPC4.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/CmdIPC4.pm b/lib/PublicInbox/CmdIPC4.pm index c3a7f56e..76938b6d 100644 --- a/lib/PublicInbox/CmdIPC4.pm +++ b/lib/PublicInbox/CmdIPC4.pm @@ -1,4 +1,4 @@ -# Copyright (C) 2020-2021 all contributors +# Copyright (C) all contributors # License: AGPL-3.0+ # callers should use PublicInbox::CmdIPC4->can('send_cmd4') (or recv_cmd4) @@ -32,7 +32,7 @@ no warnings 'once'; *recv_cmd4 = sub ($$$) { my ($s, undef, $len) = @_; # $_[1] = destination buffer my $mh = Socket::MsgHdr->new(buflen => $len, controllen => 256); - my $r = Socket::MsgHdr::recvmsg($s, $mh, 0) // return ($_[1] = undef); + my $r = Socket::MsgHdr::recvmsg($s, $mh, 0) // return (undef); $_[1] = $mh->buf; return () if $r == 0; my (undef, undef, $data) = $mh->cmsghdr; -- cgit v1.2.3-24-ge0c7