]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Syscall.pm
lei: move to v5.12 to avoid "use strict"
[public-inbox.git] / lib / PublicInbox / Syscall.pm
index cc282f9ff6bb3a3079913f1a8ecb1005fc61d0be..777c44d0660269d9753de2682b9000e04db5b4f2 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);
@@ -390,12 +389,10 @@ sub rename_noreplace ($$) {
        }
 }
 
-sub nodatacow_fh {
-       return if !defined($SYS_fstatfs);
-       my $buf = '';
-       vec($buf, 120 * 8 - 1, 1) = 0;
+sub nodatacow_fh ($) {
        my ($fh) = @_;
-       syscall($SYS_fstatfs, fileno($fh), $buf) == 0 or
+       my $buf = "\0" x 120;
+       syscall($SYS_fstatfs // return, fileno($fh), $buf) == 0 or
                return warn("fstatfs: $!\n");
        my $f_type = unpack('l!', $buf); # statfs.f_type is a signed word
        return if $f_type != 0x9123683E; # BTRFS_SUPER_MAGIC