From f19ec0e36d64bcde6cb4cbd00376fe2377e81b19 Mon Sep 17 00:00:00 2001 From: Alasdair G Kergon Date: Wed, 6 Apr 2016 22:56:45 +0100 Subject: [PATCH] lvmdump: If dir exists check dir perms too. --- scripts/lvmdump.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/lvmdump.sh b/scripts/lvmdump.sh index 19b36d37e..a81353746 100755 --- a/scripts/lvmdump.sh +++ b/scripts/lvmdump.sh @@ -100,7 +100,8 @@ else fi if test -d $dir ; then - (shopt -s nullglob dotglob; cd $dir && files=(*) && ((${#files[@]}))) && die 5 "Fatal: directory $dir already exists and is not empty" + (shopt -s nullglob dotglob; test -r $dir -a -w $dir -a -x $dir && cd $dir && files=(*) && ((! ${#files[@]}))) || \ + die 5 "Fatal: directory $dir already exists and is not empty or inaccessible" else test -e $dir && die 3 "Fatal: $dir already exists" $MKDIR -p $dir || die 4 "Fatal: could not create $dir"