summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Nielsen <knielsen@knielsen-hq.org>2015-02-23 13:36:52 +0100
committerKristian Nielsen <knielsen@knielsen-hq.org>2015-02-23 13:36:52 +0100
commit41cfdc838e551958b3b1e3a76f1e91040a628786 (patch)
tree53ecae5dae1ba5e301c061636421ccfdf468607f
parentf2cb45daf31087226632719e42a7ec66d8328e15 (diff)
downloadmariadb-git-41cfdc838e551958b3b1e3a76f1e91040a628786.tar.gz
Add error handling on realpath() call.
(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.
-rwxr-xr-xmysql-test/mysql-test-run.pl7
1 files changed, 6 insertions, 1 deletions
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index ae037c2485e..d989479b6ea 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -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 )
{