summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-03-04 22:51:15 -0500
committerDave Reisner <dreisner@archlinux.org>2012-03-05 12:33:10 -0500
commitd033692df18c1ba6385b20871e8fe5fa5a1e3514 (patch)
treeb01d9c04a473657e143140953e7212bb5a4160f6
parentecd99c311b3e5a7bbc7bf19029acad2c2a65178e (diff)
functions: check for length before using array
This avoids passing an empty array to umount Signed-off-by: Dave Reisner <dreisner@archlinux.org>
-rw-r--r--functions4
1 files changed, 3 insertions, 1 deletions
diff --git a/functions b/functions
index 833711b..a3c2660 100644
--- a/functions
+++ b/functions
@@ -505,7 +505,9 @@ umount_all() {
mounts=("$target" "${mounts[@]}")
done < <(findmnt -mrunRo TARGET,FSTYPE,OPTIONS /)
- umount -r "${mounts[@]}"
+ if (( ${#mounts[*]} )); then
+ umount -r "${mounts[@]}"
+ fi
}