[pve-devel] [PATCH common 3/3] tempfile: use /tmp for fallback-tempfiles

Wolfgang Bumiller w.bumiller at proxmox.com
Wed Nov 2 12:25:51 CET 2016


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.
---
 src/PVE/Tools.pm | 1 +
 1 file changed, 1 insertion(+)

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;
-- 
2.1.4





More information about the pve-devel mailing list