From: Wolfgang Bumiller Date: Wed, 2 Nov 2016 11:25:51 +0000 (+0100) Subject: tempfile: use /tmp for fallback-tempfiles X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=commitdiff_plain;h=77b2b96ffcc973cb070325305ce2368fb6658f4a tempfile: use /tmp for fallback-tempfiles 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. --- diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm index 0be2efe..341f0ac 100644 --- a/src/PVE/Tools.pm +++ b/src/PVE/Tools.pm @@ -1310,6 +1310,7 @@ sub tempfile { 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;