[arch-projects] [initscripts][PATCH 2/3] functions: check for length before using array

Dave Reisner d at falconindy.com
Mon Mar 5 12:35:03 EST 2012


This avoids passing an empty array to umount

Signed-off-by: Dave Reisner <dreisner at archlinux.org>
---
 functions |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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
 
 }
 
-- 
1.7.9.2



More information about the arch-projects mailing list