diff options
Diffstat (limited to 'tests/runtests.pl')
-rwxr-xr-x | tests/runtests.pl | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/runtests.pl b/tests/runtests.pl index b0bddba1c..3985f7fde 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -2713,15 +2713,21 @@ sub cleardir { my $file; # Get all files - opendir(DIR, $dir) || + opendir(my $dh, $dir) || return 0; # can't open dir - while($file = readdir(DIR)) { - if(($file !~ /^\.(|\.)$/)) { - unlink("$dir/$file"); + while($file = readdir($dh)) { + if(($file !~ /^(\.|\.\.)\z/)) { + if(-d "$dir/$file") { + cleardir("$dir/$file"); + rmdir("$dir/$file"); + } + else { + unlink("$dir/$file"); + } $count++; } } - closedir DIR; + closedir $dh; return $count; } |