[PATCH 16/18] boot command: Explicitly complain when boot target list is empty

Sascha Hauer s.hauer at pengutronix.de
Fri Jul 22 05:44:30 PDT 2016


When no targets to boot are found it can happen that the boot command
just returns silently. Explicitly print a message in this case to give
a clue what might went wrong.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 commands/boot.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/commands/boot.c b/commands/boot.c
index e757011..b774ddc 100644
--- a/commands/boot.c
+++ b/commands/boot.c
@@ -77,6 +77,11 @@ static int do_boot(int argc, char *argv[])
 		free(freep);
 	}
 
+	if (list_empty(&entries->entries)) {
+		printf("Nothing bootable found\n");
+		return COMMAND_ERROR;
+	}
+
 	if (do_list) {
 		bootsources_list(entries);
 		goto out;
-- 
2.8.1




More information about the barebox mailing list