From: Bo Borgerson Date: Mon, 28 Apr 2008 17:11:26 +0000 (-0400) Subject: tests: don't chmod after a failed chdir in cleanup X-Git-Tag: v6.12~82 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eef629eea132fa3619f508102430ac8dd1de5372;p=thirdparty%2Fcoreutils.git 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 --- diff --git a/tests/CuTmpdir.pm b/tests/CuTmpdir.pm index 84312a0391..e21306a57c 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 {