Commit b3273629 authored by unknown's avatar unknown
Browse files

Move the check that $opt_vardir could be created and was writable to the function

where we know how to creat the vardir 
Remove unused variable

parent e789cdaa
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -1883,7 +1883,6 @@ sub kill_running_servers () {
   }
}


#
# Remove var and any directories in var/ created by previous
# tests
@@ -1935,7 +1934,6 @@ sub remove_stale_vardir () {
	mtr_error("The destination for symlink $opt_vardir does not exist")
	  if ! -d readlink($opt_vardir);

	my $dir=       shift;
	foreach my $bin ( glob("$opt_vardir/*") )
	{
	  mtr_verbose("Removing bin $bin");
@@ -1997,6 +1995,19 @@ sub setup_vardir() {
    }
  }

  if ( ! -d $opt_vardir )
  {
    mtr_verbose("Creating $opt_vardir");
    mkpath($opt_vardir);
  }

  # Ensure a proper error message if vardir couldn't be created
  unless ( -d $opt_vardir and -w $opt_vardir )
  {
    mtr_error("Writable 'var' directory is needed, use the " .
	      "'--vardir=<path>' option");
  }

  mkpath("$opt_vardir/log");
  mkpath("$opt_vardir/run");
  mkpath("$opt_vardir/tmp");