From eef629eea132fa3619f508102430ac8dd1de5372 Mon Sep 17 00:00:00 2001 From: Bo Borgerson Date: Mon, 28 Apr 2008 13:11:26 -0400 Subject: 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 --- tests/CuTmpdir.pm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'tests/CuTmpdir.pm') 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 { -- cgit v1.2.3-54-g00ecf