* master - lvmdump: If dir exists check dir perms too.
@ 2016-04-06 21:57 Alasdair Kergon
0 siblings, 0 replies; only message in thread
From: Alasdair Kergon @ 2016-04-06 21:57 UTC (permalink / raw)
To: lvm-devel
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f19ec0e36d64bcde6cb4cbd00376fe2377e81b19
Commit: f19ec0e36d64bcde6cb4cbd00376fe2377e81b19
Parent: 55001ae9ec2c00a070f8dfa8541f4f17a6e2a284
Author: Alasdair G Kergon <agk@redhat.com>
AuthorDate: Wed Apr 6 22:56:45 2016 +0100
Committer: Alasdair G Kergon <agk@redhat.com>
CommitterDate: Wed Apr 6 22:56:45 2016 +0100
lvmdump: If dir exists check dir perms too.
---
scripts/lvmdump.sh | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/scripts/lvmdump.sh b/scripts/lvmdump.sh
index 19b36d3..a813537 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"
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-04-06 21:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-06 21:57 master - lvmdump: If dir exists check dir perms too Alasdair Kergon
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.