From e8aec371654480a9173913aaa5fead65a1304baa Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 21 Sep 2011 00:03:22 -0400 Subject: [PATCH] cros_sdk: skip unmount phase if no mounts are found Normally safe_umount_tree isn't called if there are no mount points in the chroot, but there are some edge cases (like early setup errors) where it may be possible. So add a simple check to make sure that there are mount points for us to work on before calling umount. BUG=None TEST=add early `die` before mounts; see no umount error output Change-Id: I57e5022c3242c635097bceed44772f10eecf6a64 Reviewed-on: http://gerrit.chromium.org/gerrit/8026 Reviewed-by: Raymes Khoury Reviewed-by: David James Commit-Ready: Mike Frysinger Tested-by: Mike Frysinger --- common.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common.sh b/common.sh index faa910244a..04c9c157bd 100644 --- a/common.sh +++ b/common.sh @@ -393,6 +393,11 @@ function sub_mounts() { function safe_umount_tree { local mounts=$(sub_mounts "$1") + # Hmm, this shouldn't normally happen, but anything is possible. + if [ -z "${mounts}" ] ; then + return 0 + fi + # First try to unmount in one shot to speed things up. if sudo umount -d ${mounts}; then return 0