If MENUFILE (/env/menu/mainmenu) doesn't exist, an infinite loop will keep executing this non-existent file. If this happens, let's exit the infinite loop and hang barebox instead. Previously we dropped to a shell in this situation, but this was changed as menu-only boots should not be circumventable and drop to a shell due to errors. Fixes: 96852a962d0c ("startup: don't fallback to shell from menu") Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- common/startup.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/common/startup.c b/common/startup.c index 723d4f1ecc3b..3debb6668be7 100644 --- a/common/startup.c +++ b/common/startup.c @@ -344,10 +344,15 @@ static int run_init(void) run_shell(); } - while (1) + do { + /* + * Let's run the command once at least, so an error + * message is printed if the file doesn't exist + */ run_command(MENUFILE); + } while (stat(MENUFILE, &s) == 0); - unreachable(); + hang(); } typedef void (*ctor_fn_t)(void); -- 2.39.5