avoid endless loop

This commit is contained in:
illiliti 2020-02-19 12:48:46 +03:00
parent 3f2cd7cca5
commit 3f4d039ac9

7
init
View File

@ -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"
}