Patchwork [U-Boot,RFC/PATCHv2,2/2] Common/cmd_nvedit: Check for env subcommand

login
register
mail settings
Submitter Thomas Weber
Date Nov. 24, 2010, 12:07 p.m.
Message ID <1290600472-23147-2-git-send-email-weber@corscience.de>
Download mbox | patch
Permalink /patch/72844/
State Accepted
Commit 5904da021449c6d2404485dc1379bf0f3b33414a
Headers show

Comments

Thomas Weber - Nov. 24, 2010, 12:07 p.m.
The env command needs one subcommand. If this is not available
print the usage help.

Signed-off-by: Thomas Weber <weber@corscience.de>
---
 common/cmd_nvedit.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Wolfgang Denk - Nov. 27, 2010, 10:19 p.m.
Dear Thomas Weber,

In message <1290600472-23147-2-git-send-email-weber@corscience.de> you wrote:
> The env command needs one subcommand. If this is not available
> print the usage help.
> 
> Signed-off-by: Thomas Weber <weber@corscience.de>
> ---
>  common/cmd_nvedit.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Patch

diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 3fd8abc..52c5e7c 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -848,6 +848,9 @@  static int do_env (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	cmd_tbl_t *cp;
 
+	if (argc < 2)
+		return cmd_usage(cmdtp);
+
 	/* drop initial "env" arg */
 	argc--;
 	argv++;