From: Piotr Dymacz Date: Wed, 5 Apr 2017 21:15:48 +0000 (+0200) Subject: Clear env vars used in recovery script before and after running it X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=0046a443476900c52dc8a524af8635c10bd68d94;p=oweals%2Fu-boot_mod.git Clear env vars used in recovery script before and after running it Recovery script uses two variables: a button press time counter (cnt) and a flag (stop_boot) used later to decide if booting process should be interrupted. Clear their values before and after running recovery script as they could already exist in environment (could be accidentally saved). --- diff --git a/u-boot/common/main.c b/u-boot/common/main.c index 6237d15..4a59988 100644 --- a/u-boot/common/main.c +++ b/u-boot/common/main.c @@ -162,14 +162,25 @@ void main_loop(void) gd->flags &= ~(GD_FLG_SILENT); #endif + /* + * Always clear values of variables used in recovery script + * as they could be accidentally saved before + */ + setenv("stop_boot", NULL); + setenv("cnt", NULL); + run_command("run recovery", 0); /* Should we stop booting after recovery mode? */ c = getenv("stop_boot"); stop_boot = c ? (int)simple_strtol(c, NULL, 10) : 0; - if (stop_boot) + if (stop_boot) { + setenv("stop_boot", NULL); bootcmd = NULL; + } + + setenv("cnt", NULL); } #endif /* CONFIG_RECOVERY_MODE */