At this point we know it's not a tmpfs (as tmpfs definitely
supports O_TMPFILE), so /tmp makes more sense than /run as
default path.
my $fh = IO::File->new($dir, $mode | O_TMPFILE, $perm);
if (!$fh && $! == EOPNOTSUPP) {
my $fh = IO::File->new($dir, $mode | O_TMPFILE, $perm);
if (!$fh && $! == EOPNOTSUPP) {
+ $dir = '/tmp' if !defined($opts{dir});
$dir .= "/.tmpfile.$$";
$fh = IO::File->new($dir, $mode | O_CREAT | O_EXCL, $perm);
unlink($dir) if $fh;
$dir .= "/.tmpfile.$$";
$fh = IO::File->new($dir, $mode | O_CREAT | O_EXCL, $perm);
unlink($dir) if $fh;