summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarian Csontos <mcsontos@redhat.com>2015-06-04 11:31:24 +0200
committerMarian Csontos <mcsontos@redhat.com>2015-06-16 10:15:18 +0200
commite7b5c219ad9c2638626b772ee0706729035b7371 (patch)
tree0b4d07da77e506eca744ecb11a3ce8df12db33e6
parentce18fb61c0a3b94b642edb056a717a198473449c (diff)
downloadlvm2-dev-mcsontos-test-mkdtemp.tar.gz
Add check destdir existsdev-mcsontos-test-mkdtemp
mkdir later is not creating parent directories and it is not desirable to use `mkdir -p` which could lead to existing directory reuse. So the parent directory should either exist or should be created.
-rw-r--r--test/lib/utils.sh2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/lib/utils.sh b/test/lib/utils.sh
index fe7ccd3bc..24c9076d4 100644
--- a/test/lib/utils.sh
+++ b/test/lib/utils.sh
@@ -57,6 +57,8 @@ mkdtemp() {
destdir=$1
template=$2
+ test -d "$destdir" || die "DIR ('$destdir') does not exist."
+
case "$template" in
*XXXX) ;;
*) die "Invalid template: $template (must have a suffix of at least 4 X's)";;