[2/3] mkefidisk.sh: fix hanging on non-writeable device

Submitted by Paul Eggleton on April 21, 2015, 1:01 p.m. | Patch ID: 92167

Details

Message ID 783f2e243ee5714fe36119e674fa4db77ba52281.1429621253.git.paul.eggleton@linux.intel.com
State New
Headers show

Commit Message

Paul Eggleton April 21, 2015, 1:01 p.m.
If cleanup() is called early on, as happens when the device isn't
writeable, then none of the mount point variables are set; thus the
script was calling grep with only one argument and appeared to hang
since it was waiting for input on stdin.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 scripts/contrib/mkefidisk.sh | 3 +++
 1 file changed, 3 insertions(+)

Patch hide | download patch | download mbox

diff --git a/scripts/contrib/mkefidisk.sh b/scripts/contrib/mkefidisk.sh
index 74cf40d..d6bc965 100755
--- a/scripts/contrib/mkefidisk.sh
+++ b/scripts/contrib/mkefidisk.sh
@@ -136,6 +136,9 @@  unmount_device() {
 }
 
 unmount() {
+	if [ "$1" = "" ] ; then
+		return 0
+	fi
 	grep -q $1 /proc/mounts
 	if [ $? -eq 0 ]; then
 		debug "Unmounting $1"