[Tools] winetest: Use a move function that works across filesystems.

Francois Gouget fgouget at codeweavers.com
Wed Feb 8 01:07:23 CST 2017


If CGI ignores $TMPDIR for any reason, the file will likely be in /tmp,
i.e. on a different filesystem.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 winetest/winetest.cgi | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/winetest/winetest.cgi b/winetest/winetest.cgi
index 98a5260a..93906bf8 100755
--- a/winetest/winetest.cgi
+++ b/winetest/winetest.cgi
@@ -25,6 +25,7 @@ BEGIN {
     $ENV{TMPDIR} = $queuedir;
 }
 
+use File::Copy;
 use File::Temp qw(tempdir);
 use CGI qw(:standard);
 # Cater for some overhead
@@ -50,7 +51,9 @@ sub move_file($)
     chmod 0777, $tmpdir;
     chmod 0666&~umask, $orig;
     my $size = -s $orig;
-    (rename $orig, "$tmpdir/report")?
+    # Note that we are stealing CGI's temporary file which typically results
+    # in a warning in the web server's logs. Still seems to work though.
+    (move $orig, "$tmpdir/report")?
       "Received $filename ($size bytes).\n":
       "Error: can't store $filename: $!\n";
 }
-- 
2.11.0




More information about the wine-patches mailing list