From: Eric Wong Date: Sat, 8 Feb 2025 03:26:33 +0000 (+0000) Subject: syscall: `use bytes' throughout X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d570b94f9f889e9c87d9f24dccda5418905779d3;p=thirdparty%2Fpublic-inbox.git syscall: `use bytes' throughout All *nix syscalls operate on the byte-level with no knowledge of encodings, so ensure all `substr' and `length' calculations use the bytes(3perl) pragma. --- diff --git a/lib/PublicInbox/Syscall.pm b/lib/PublicInbox/Syscall.pm index e5e3340fa..d005fecb6 100644 --- a/lib/PublicInbox/Syscall.pm +++ b/lib/PublicInbox/Syscall.pm @@ -18,6 +18,7 @@ package PublicInbox::Syscall; use v5.12; use parent qw(Exporter); +use bytes qw(length substr); use POSIX qw(ENOENT ENOSYS EINVAL O_NONBLOCK); use Socket qw(SOL_SOCKET SCM_RIGHTS); use Config; @@ -544,7 +545,6 @@ require PublicInbox::CmdIPC4; }; *sendmsg_more = sub ($@) { - use bytes qw(length substr); my $sock = shift; my $iov = join('', map { pack 'P'.TMPL_size_t, $_, length } @_); my $mh = pack(TMPL_msghdr, @@ -563,7 +563,6 @@ require PublicInbox::CmdIPC4; if (defined($SYS_writev)) { *writev = sub { my $fh = shift; - use bytes qw(length substr); my $iov = join('', map { pack 'P'.TMPL_size_t, $_, length } @_); my $w; do {