summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlasdair G Kergon <agk@redhat.com>2016-04-06 22:56:45 +0100
committerAlasdair G Kergon <agk@redhat.com>2016-04-06 22:56:45 +0100
commitf19ec0e36d64bcde6cb4cbd00376fe2377e81b19 (patch)
treefd7a701be6c43c7fbe39180d7179076fcedc8cf8
parent55001ae9ec2c00a070f8dfa8541f4f17a6e2a284 (diff)
downloadlvm2-f19ec0e36d64bcde6cb4cbd00376fe2377e81b19.tar.gz
lvmdump: If dir exists check dir perms too.
-rwxr-xr-xscripts/lvmdump.sh3
1 files changed, 2 insertions, 1 deletions
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"