Skip to content

Commit

Permalink
Add error handling on realpath() call.
Browse files Browse the repository at this point in the history
(Without this, it happened for me that realpath() failed returning
undef for the default vardir. This in turn caused mysql-test-run.pl to
delete the source mysql-test/ directory.)

Backport from 10.1, it's not nice to get one's source directory nuked
by a rouge mysql-test-run.
  • Loading branch information
knielsen committed Feb 23, 2015
1 parent f2cb45d commit 41cfdc8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mysql-test/mysql-test-run.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1502,7 +1502,12 @@ sub command_line_setup {
{
$default_vardir= "$glob_mysql_test_dir/var";
}
$default_vardir = realpath $default_vardir unless IS_WINDOWS;
unless (IS_WINDOWS) {
my $realpath = realpath($default_vardir);
die "realpath('$default_vardir') failed: $!\n"
unless defined($realpath) && $realpath ne '';
$default_vardir = $realpath;
}

if ( ! $opt_vardir )
{
Expand Down

0 comments on commit 41cfdc8

Please sign in to comment.