]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Syscall.pm
syscall: initialize buffer for vec()
[public-inbox.git] / lib / PublicInbox / Syscall.pm
index 22b779ad6933464e327340593669439e12b3aef6..412ca64ff5891f06d11bd0cbf268f978b0cde806 100644 (file)
@@ -16,8 +16,7 @@
 # You may distribute under the terms of either the GNU General Public
 # License or the Artistic License, as specified in the Perl README file.
 package PublicInbox::Syscall;
-use strict;
-use v5.10.1;
+use v5.12;
 use parent qw(Exporter);
 use POSIX qw(ENOENT ENOSYS EINVAL O_NONBLOCK);
 use Socket qw(SOL_SOCKET SCM_RIGHTS);
@@ -207,7 +206,7 @@ if ($^O eq "linux") {
         $u64_mod_8        = 1;
         $SYS_signalfd4 = 484;
        $SFD_CLOEXEC = 010000000;
-    } elsif ($machine eq 'aarch64' || $machine eq 'loongarch64') {
+    } elsif ($machine =~ /\A(?:loong)?aarch64\z/ || $machine eq 'riscv64') {
         $SYS_epoll_create = 20;  # (sys_epoll_create1)
         $SYS_epoll_ctl    = 21;
         $SYS_epoll_wait   = 22;  # (sys_epoll_pwait)
@@ -455,7 +454,7 @@ no warnings 'once';
 
 *recv_cmd4 = sub ($$$) {
        my ($sock, undef, $len) = @_;
-       vec($_[1], ($len + 1) * 8, 1) = 0;
+       vec($_[1] //= '', ($len + 1) * 8, 1) = 0;
        my $cmsghdr = "\0" x msg_controllen; # 10 * sizeof(int)
        my $iov = pack('P'.TMPL_size_t, $_[1], $len);
        my $mh = pack('PL' . # msg_name, msg_namelen (socklen_t (U32))