summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBo Borgerson <gigabo@gmail.com>2008-04-28 13:11:26 -0400
committerJim Meyering <meyering@redhat.com>2008-04-28 19:29:15 +0200
commiteef629eea132fa3619f508102430ac8dd1de5372 (patch)
tree1efcfb403243156aedc42d1fbbfa4fabf418aa55 /tests
parent2f55920ffc37474ac75eadfbe5d987eb0ea248cc (diff)
downloadcoreutils-eef629eea132fa3619f508102430ac8dd1de5372.tar.xz
tests: don't chmod after a failed chdir in cleanup
* tests/CuTmpdir.pm (chmod_tree): Don't chmod if chdir failed. Signed-off-by: Bo Borgerson <gigabo@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/CuTmpdir.pm15
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/CuTmpdir.pm b/tests/CuTmpdir.pm
index 84312a039..e21306a57 100644
--- a/tests/CuTmpdir.pm
+++ b/tests/CuTmpdir.pm
@@ -45,11 +45,16 @@ sub chmod_1
sub chmod_tree
{
- chdir $dir
- or warn "$ME: failed to chdir to $dir: $!\n";
- # Perform the equivalent of find . -type d -print0|xargs -0 chmod -R 700.
- my $options = {untaint => 1, wanted => \&chmod_1};
- find ($options, '.');
+ if (chdir $dir)
+ {
+ # Perform the equivalent of find . -type d -print0|xargs -0 chmod -R 700.
+ my $options = {untaint => 1, wanted => \&chmod_1};
+ find ($options, '.');
+ }
+ else
+ {
+ warn "$ME: failed to chdir to $dir: $!\n";
+ }
}
sub import {