From 2173bda09cc30fb1dbb2fbc8855819daf908db85 Mon Sep 17 00:00:00 2001 From: Patrick Zysset Date: Tue, 25 Jan 2022 18:17:23 +0100 Subject: [PATCH] mac-address-set: add timeout to wait_on function if a device is never getting ready on startup sequence, the wait_on() function runs forever. with this patch it aborts after 10 seconds. BugzID: 77171 Signed-off-by: Patrick Zysset --- recipes-bsp/mac-address-set/files/mac-address-set.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/recipes-bsp/mac-address-set/files/mac-address-set.sh b/recipes-bsp/mac-address-set/files/mac-address-set.sh index e46c1f3..8bd9cc0 100755 --- a/recipes-bsp/mac-address-set/files/mac-address-set.sh +++ b/recipes-bsp/mac-address-set/files/mac-address-set.sh @@ -66,8 +66,15 @@ wait_on() { fi log_info "$device not ready" log_info "Waiting...." + wait_timeout=0 while ! $cmd "$device" > /dev/null 2>/dev/null; do - sleep 1 + if [ $wait_timeout -gt 10 ]; then + log_warning "Timeout after 10 seconds, exiting now.." + break + else + sleep 1 + fi + wait_timeout=$(($wait_timeout+1)) done log_info "$device ready" }