From 688073771da95df0d7551b8361e264180bfffe5f Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues Date: Fri, 30 Nov 2007 08:53:38 +0100 Subject: [PATCH] * tests/CuTmpdir.pm (END): Do not do the cleanup if $dir is not defined, because it then goes wild and changes the mode of all directories below $HOME. Undefined $dir can happen if the test is to be skipped because of an unsafe working directory name. --- ChangeLog | 7 +++++++ tests/CuTmpdir.pm | 13 ++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 38401db..8a080b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-11-30 Ralf Wildenhues + + * tests/CuTmpdir.pm (END): Do not do the cleanup if $dir is not + defined, because it then goes wild and changes the mode of all + directories below $HOME. Undefined $dir can happen if the test + is to be skipped because of an unsafe working directory name. + 2007-11-28 Paul Eggert Close a file descriptor leak when cp --preserve=context fails. diff --git a/tests/CuTmpdir.pm b/tests/CuTmpdir.pm index f8d43d5..38bc724 100644 --- a/tests/CuTmpdir.pm +++ b/tests/CuTmpdir.pm @@ -64,11 +64,14 @@ sub wanted END { my $saved_errno = $?; - 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 => \&wanted}; - find ($options, '.'); + if (defined $dir) + { + 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 => \&wanted}; + find ($options, '.'); + } $? = $saved_errno; } -- 2.7.4