From 1476a70e18cbf914b02f8b400e1b7cd08cbeb2fa Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Mon, 20 May 2019 13:08:33 +0200 Subject: lib/common-functions: recursively_umount_and_rm(): check that argument is directory --- lib/common-functions | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/common-functions') diff --git a/lib/common-functions b/lib/common-functions index 9ba495c..6ff5b2c 100755 --- a/lib/common-functions +++ b/lib/common-functions @@ -390,6 +390,12 @@ recursively_umount_and_rm() { exit 42 fi + if [ ! -d "${dir}" ]; then + >&2 printf 'ERROR: recursively_umount_and_rm requires a directory as argument - "%s" is not\n' \ + "${dir}" + exit 42 + fi + # the sh -c '...' construct branch below is borrowed from # archlinux/devtools lib/archroot.sh: is_subvolume(), is_same_fs() and # subvolume_delete_recursive() -- cgit v1.2.3-54-g00ecf