From 3f4d039ac9210e53a05a15ffbaa596448d833669 Mon Sep 17 00:00:00 2001 From: illiliti Date: Wed, 19 Feb 2020 12:48:46 +0300 Subject: [PATCH] avoid endless loop --- init | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/init b/init index 4001252..691aef2 100644 --- a/init +++ b/init @@ -66,7 +66,12 @@ findfs_sh() { esac # avoid race condition - until [ -e "$device" ]; do sleep 0.5; done + while [ ! -e "$device" ]; do + sleep 0.5 + [ "$increment" ] || increment=0 + increment=$(( increment + 1 )) + [ "$increment" = 10 ] && panic "failed to lookup rootfs" + done printf "%s\n" "$device" }