From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 2/3] recv_cmd: do not undef recvmsg buffer arg on errors
Date: Wed, 23 Mar 2022 08:54:34 +0000 [thread overview]
Message-ID: <20220323085435.1391088-3-e@80x24.org> (raw)
In-Reply-To: <20220323085435.1391088-1-e@80x24.org>
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 <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# 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;
next prev parent reply other threads:[~2022-03-23 8:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-23 8:54 [PATCH 0/3] support sendmsg+recvmsg in pure Perl under Linux Eric Wong
2022-03-23 8:54 ` [PATCH 1/3] syscall: drop unused EEXIST import Eric Wong
2022-03-23 8:54 ` Eric Wong [this message]
2022-03-23 8:54 ` [PATCH 3/3] syscall: implement sendmsg+recvmsg in pure Perl Eric Wong
2022-03-23 21:08 ` [PATCH 4/3] syscall: add sendmsg+recvmsg for remaining arches Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220323085435.1391088-3-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).