- skip 'chattr(1) not installed', $nr unless which('chattr');
- my $lsattr = which('lsattr') or skip 'lsattr(1) not installed', $nr;
- my ($fh, $name) = tempfile(DIR => $dir, UNLINK => 1);
- BAIL_OUT "tempfile: $!" unless $fh && defined($name);
- my $pp_sub = \&PublicInbox::NDC_PP::set_nodatacow;
+ require_cmd('chattr', 1) or skip 'chattr(1) not installed', $nr;
+ my $lsattr = require_cmd('lsattr', 1) or
+ skip 'lsattr(1) not installed', $nr;
+ my $tmp = File::Temp->newdir('nodatacow-XXXX', DIR => $dir);
+ my $dn = $tmp->dirname;
+
+ my $name = "$dn/pp.f";
+ open my $fh, '>', $name or BAIL_OUT "open($name): $!";
+ my $pp_sub = \&PublicInbox::NDC_PP::nodatacow_fd;