Francois Gouget : winetest: Use a move function that works across filesystems.

Alexandre Julliard julliard at winehq.org
Wed Feb 8 15:23:06 CST 2017


Module: tools
Branch: master
Commit: 5061b7f7e43b5035e3f492ba726c76c7e84168ca
URL:    http://source.winehq.org/git/tools.git/?a=commit;h=5061b7f7e43b5035e3f492ba726c76c7e84168ca

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Wed Feb  8 08:07:23 2017 +0100

winetest: Use a move function that works across filesystems.

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>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 winetest/winetest.cgi | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/winetest/winetest.cgi b/winetest/winetest.cgi
index 98a5260..93906bf 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";
 }




More information about the wine-cvs mailing list