From d570b94f9f889e9c87d9f24dccda5418905779d3 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 8 Feb 2025 03:26:33 +0000 Subject: [PATCH] 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. --- lib/PublicInbox/Syscall.pm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 { -- 2.47.3