mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/3] commands: boot: fix error code/clean up behavior when not booting
Date: Tue, 24 Nov 2020 09:47:44 +0100	[thread overview]
Message-ID: <20201124084744.GD14718@pengutronix.de> (raw)
In-Reply-To: <20201123161432.28064-1-a.fatoum@pengutronix.de>

On Mon, Nov 23, 2020 at 05:14:30PM +0100, Ahmad Fatoum wrote:
> 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(-)

Applied, thanks

Sascha

> 
> 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
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

      parent reply	other threads:[~2020-11-24  8:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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
2020-11-23 16:14 ` [PATCH 3/3] commands: boot: include blspec path name in entry title Ahmad Fatoum
2020-11-24  8:47 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201124084744.GD14718@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox