All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] commands: boot: fix error code/clean up behavior when not booting
@ 2020-11-23 16:14 Ahmad Fatoum
  2020-11-23 16:14 ` [PATCH 2/3] commands: boot: display each list entry in a separate line Ahmad Fatoum
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2020-11-23 16:14 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

The boot command won't boot if:
  - There are no boot entries: we should still clean up before
    returning an error
  - A menu or list of found entries should be displayed: we should
    exit with success
  - We were doing a dry run: we should propagate the boot entry
    boot method's exit code

Do the necessary.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 commands/boot.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/commands/boot.c b/commands/boot.c
index d7795bde726b..18f4e36ec733 100644
--- a/commands/boot.c
+++ b/commands/boot.c
@@ -97,19 +97,16 @@ static int do_boot(int argc, char *argv[])
 
 	if (list_empty(&entries->entries)) {
 		printf("Nothing bootable found\n");
-		return COMMAND_ERROR;
-	}
-
-	if (do_list) {
-		bootsources_list(entries);
+		ret = COMMAND_ERROR;
 		goto out;
 	}
 
-	if (do_menu) {
+	if (do_list)
+		bootsources_list(entries);
+	else if (do_menu)
 		bootsources_menu(entries, timeout);
-		goto out;
-	}
 
+	ret = 0;
 out:
 	bootentries_free(entries);
 	free(freep);
-- 
2.29.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-11-24  8:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-23 16:14 [PATCH 1/3] commands: boot: fix error code/clean up behavior when not booting Ahmad Fatoum
2020-11-23 16:14 ` [PATCH 2/3] commands: boot: display each list entry in a separate line Ahmad Fatoum
2020-11-23 16:14 ` [PATCH 3/3] commands: boot: include blspec path name in entry title Ahmad Fatoum
2020-11-24  8:47 ` [PATCH 1/3] commands: boot: fix error code/clean up behavior when not booting Sascha Hauer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.