Commit f31e935c authored by Sergei Golubchik's avatar Sergei Golubchik

mtr: fix a race condition

if a test can run in cond1,cond2 and cond1,cond3 then they can happen
to run in parallel and both wanting to create test,cond1.result~
parent 2e7e89d6
......@@ -3359,17 +3359,21 @@ sub do_before_run_mysqltest($)
if ($^O eq "MSWin32") {
push @cmd, '--binary';
}
push @cmd, (qw/-r - -f -s -o/, $dest, $base_result, $resfile);
push @cmd, (qw/-r - -f -s -o/, $dest . $$, $base_result, $resfile);
if (-w $resdir) {
# don't rebuild a file if it's up to date
unless (-e $dest and -M $dest < -M $resfile
and -M $dest < -M $base_result) {
run_system(@cmd);
rename $cmd[-3], $dest or unlink $cmd[-3];
}
} else {
$cmd[-3] = $dest = $opt_tmpdir . '/' . basename($dest);
$dest = $opt_tmpdir . '/' . basename($dest);
$cmd[-3] = $dest . $$;
run_system(@cmd);
rename $cmd[-3], $dest or unlink $cmd[-3];
}
$tinfo->{result_file} = $dest;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment